Fix WebSocket proxy ping timeout killing MSE streams
The websockets library defaults to ping_interval=20, ping_timeout=20. go2rtc doesn't respond to these pings, so the upstream WebSocket was being killed after ~50 seconds causing all camera streams to freeze. Disabled ping_interval and ping_timeout on the upstream connection.
This commit is contained in:
@@ -43,7 +43,12 @@ async def proxy_mse_ws(ws: WebSocket, src: str):
|
|||||||
await ws.accept()
|
await ws.accept()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with websockets.connect(target) as upstream:
|
async with websockets.connect(
|
||||||
|
target,
|
||||||
|
ping_interval=None,
|
||||||
|
ping_timeout=None,
|
||||||
|
close_timeout=5,
|
||||||
|
) as upstream:
|
||||||
|
|
||||||
async def forward_to_client():
|
async def forward_to_client():
|
||||||
async for msg in upstream:
|
async for msg in upstream:
|
||||||
|
|||||||
Reference in New Issue
Block a user