fix: WebSocket proxy drops text frames — receive_bytes() silently fails on auth token
terminal.js sends the ttyd auth token as a TEXT WebSocket frame. The proxy's client_to_ttyd() called receive_bytes() which fails silently on text frames, swallows the exception, and exits — auth never reached ttyd, ttyd never started streaming, resulting in permanent black screen and reconnect loop. Fix: use receive() and dispatch on message type, handling both bytes and text.
This commit is contained in:
+5
-2
@@ -365,8 +365,11 @@ async def terminal_ws_proxy(websocket: WebSocket) -> None:
|
||||
async def client_to_ttyd() -> None:
|
||||
try:
|
||||
while True:
|
||||
data = await websocket.receive_bytes()
|
||||
await ttyd_ws.send(data)
|
||||
msg = await websocket.receive()
|
||||
if msg.get("bytes"):
|
||||
await ttyd_ws.send(msg["bytes"])
|
||||
elif msg.get("text"):
|
||||
await ttyd_ws.send(msg["text"])
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user