diff --git a/app/public/index.html b/app/public/index.html
index 0b957e0..910f0d5 100644
--- a/app/public/index.html
+++ b/app/public/index.html
@@ -16,26 +16,6 @@
const wsUrl = `${location.protocol === 'https:' ? 'wss' : 'ws'}://${location.host}/ws/${cameraId}`;
const player = mpegts.createPlayer(
{ type: 'mpegts', isLive: true, url: wsUrl, hasAudio: false },
- {
- enableWorker: true, // transmuxing в отдельном треде
- enableStashBuffer: true, // включить stash
- stashInitialSize: 384,
-
- autoCleanupSourceBuffer: true, // не копить старые буферы в MSE
- autoCleanupMaxBackwardDuration: 10,
- autoCleanupMinBackwardDuration: 5,
-
- // liveSync — плавное догоняние через playbackRate, а не жёсткий seek
- liveSync: true,
- liveSyncTargetLatency: 4.0, // target после выравнивания ← дать буферу вырасти
- liveSyncMaxLatency: 10.0, // при плохом интернете даём 10с ← не трогать буфер до 10s
- liveSyncPlaybackRate: 1.05, // ускорение не более 1.2x ← очень мягкое догоняние
-
- liveBufferLatencyChasing: false, // включить stash ← убрать конфликтующий механизм
-
- lazyLoad: false,
- deferLoadAfterSourceOpen: false,
- }
);
player.attachMediaElement(document.getElementById('v'))
player.load()
diff --git a/app/src/mqtt.ts b/app/src/mqtt.ts
index 9637eb8..4e599ac 100644
--- a/app/src/mqtt.ts
+++ b/app/src/mqtt.ts
@@ -6,7 +6,12 @@ import { routeMessage } from './router.js'
const mqttUrl = process.env.MQTT_URL as string
-export const mqttClient = mqtt.connect(mqttUrl)
+export const mqttClient = mqtt.connect(mqttUrl, {
+ clean: true,
+ queueQoSZero: false,
+ reconnectPeriod: 1000,
+ connectTimeout: 10000,
+});
mqttClient.on('connect', () => {
log('mqtt.connected', { url: mqttUrl })
diff --git a/app/src/stream/edge-chunk-relay.ts b/app/src/stream/edge-chunk-relay.ts
index 507c7f2..1b6c503 100644
--- a/app/src/stream/edge-chunk-relay.ts
+++ b/app/src/stream/edge-chunk-relay.ts
@@ -21,6 +21,7 @@ function getClients(cameraId: string): Set {
wss.on('connection', (ws: WebSocket, req: IncomingMessage) => {
log(`ws.connection ${req.url}`);
+ req.socket.setNoDelay(true)
const cameraId = req.url ? lastTopicSegment(req.url) : 'v1';
const clients = getClients(cameraId);
diff --git a/app/src/stream/ws-pipe-relay.ts b/app/src/stream/ws-pipe-relay.ts
index e29cc06..4438a63 100644
--- a/app/src/stream/ws-pipe-relay.ts
+++ b/app/src/stream/ws-pipe-relay.ts
@@ -87,6 +87,7 @@ function handleViewer(ws: WebSocket, channel: string, path: string): void {
wss.on('connection', (ws: WebSocket, req: IncomingMessage) => {
const path = req.url?.split('?')[0] ?? ''
+ req.socket.setNoDelay(true);
if (path.startsWith('/out/')) {
handleViewer(ws, lastTopicSegment(path), path)
diff --git a/mosquitto/config/mosquitto.conf b/mosquitto/config/mosquitto.conf
index 2fcc864..464b3c0 100644
--- a/mosquitto/config/mosquitto.conf
+++ b/mosquitto/config/mosquitto.conf
@@ -1,6 +1,8 @@
listener 1883
allow_anonymous true
+set_tcp_nodelay true # выключает Nagle на всех сокетах брокера
+
persistence true
persistence_location /mosquitto/data/