WS: ping before init
このコミットが含まれているのは:
コミット
8f06121d8f
|
@ -17,7 +17,8 @@ from anonstream.utils.websocket import parse_websocket_data, Malformed, WS
|
||||||
CONFIG = current_app.config
|
CONFIG = current_app.config
|
||||||
|
|
||||||
async def websocket_outbound(queue, user):
|
async def websocket_outbound(queue, user):
|
||||||
payload = {
|
await websocket.send_json({'type': 'ping'})
|
||||||
|
await websocket.send_json({
|
||||||
'type': 'init',
|
'type': 'init',
|
||||||
'nonce': generate_nonce(),
|
'nonce': generate_nonce(),
|
||||||
'title': await get_stream_title(),
|
'title': await get_stream_title(),
|
||||||
|
@ -31,9 +32,7 @@ async def websocket_outbound(queue, user):
|
||||||
'scrollback': CONFIG['MAX_CHAT_SCROLLBACK'],
|
'scrollback': CONFIG['MAX_CHAT_SCROLLBACK'],
|
||||||
'digest': get_random_captcha_digest_for(user),
|
'digest': get_random_captcha_digest_for(user),
|
||||||
'pingpong': CONFIG['TASK_BROADCAST_PING'],
|
'pingpong': CONFIG['TASK_BROADCAST_PING'],
|
||||||
}
|
})
|
||||||
await websocket.send_json(payload)
|
|
||||||
await websocket.send_json({'type': 'ping'})
|
|
||||||
while True:
|
while True:
|
||||||
payload = await queue.get()
|
payload = await queue.get()
|
||||||
if payload['type'] == 'close':
|
if payload['type'] == 'close':
|
||||||
|
|
読み込み中…
新しいイシューから参照