WS: ping before init

このコミットが含まれているのは:
n9k 2022-06-14 00:34:24 +00:00
コミット 8f06121d8f
1個のファイルの変更3行の追加4行の削除

ファイルの表示

@ -17,7 +17,8 @@ from anonstream.utils.websocket import parse_websocket_data, Malformed, WS
CONFIG = current_app.config
async def websocket_outbound(queue, user):
payload = {
await websocket.send_json({'type': 'ping'})
await websocket.send_json({
'type': 'init',
'nonce': generate_nonce(),
'title': await get_stream_title(),
@ -31,9 +32,7 @@ async def websocket_outbound(queue, user):
'scrollback': CONFIG['MAX_CHAT_SCROLLBACK'],
'digest': get_random_captcha_digest_for(user),
'pingpong': CONFIG['TASK_BROADCAST_PING'],
}
await websocket.send_json(payload)
await websocket.send_json({'type': 'ping'})
})
while True:
payload = await queue.get()
if payload['type'] == 'close':