Fix: keep connection
This commit is contained in:
parent
26312a655b
commit
77127d3476
1 changed files with 25 additions and 25 deletions
|
@ -1,6 +1,5 @@
|
|||
import asyncio
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
import secrets
|
||||
import time
|
||||
|
@ -25,6 +24,7 @@ def generate_key() -> str:
|
|||
|
||||
|
||||
async def handler(socket: websockets.WebSocketServerProtocol) -> None:
|
||||
async for message in socket:
|
||||
data = json.loads(await socket.recv())
|
||||
if 'action' not in data:
|
||||
await socket.send(response.error_field('action'))
|
||||
|
@ -46,7 +46,7 @@ async def handler(socket: websockets.WebSocketServerProtocol) -> None:
|
|||
if 'url' not in data:
|
||||
await socket.send(response.error_field('url'))
|
||||
return
|
||||
# TODO: pass command to the thread started in `init`
|
||||
# TODO: start thread and send all yt-dlp's output to client
|
||||
await socket.send(response.OK)
|
||||
case _:
|
||||
await socket.send(response.error_field('action'))
|
||||
|
|
Loading…
Add table
Reference in a new issue