mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-12-05 14:19:58 -05:00
add hangup listener so we can close websocket
This commit is contained in:
parent
0619dfb3e6
commit
7628ee2ce1
2 changed files with 18 additions and 0 deletions
10
web.py
10
web.py
|
|
@ -316,8 +316,18 @@ class ReticulumWebChat:
|
|||
# ignore errors sending audio packets to websocket
|
||||
pass
|
||||
|
||||
# close websocket when call is hungup
|
||||
def on_hangup():
|
||||
if websocket_response.closed is False:
|
||||
try:
|
||||
asyncio.run(websocket_response.close(code=WSCloseCode.GOING_AWAY))
|
||||
except:
|
||||
# ignore errors closing websocket
|
||||
pass
|
||||
|
||||
# register audio packet listener
|
||||
audio_call.register_audio_packet_listener(on_audio_packet)
|
||||
audio_call.register_hangup_listener(on_hangup)
|
||||
|
||||
# prepare websocket response
|
||||
websocket_response = web.WebSocketResponse()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue