fix: serve.py Python 3.8 兼容,asyncio.run 改为手动 event loop
This commit is contained in:
+4
-1
@@ -112,7 +112,10 @@ async def ws_handler(websocket, path):
|
|||||||
|
|
||||||
|
|
||||||
def run_websocket_server():
|
def run_websocket_server():
|
||||||
asyncio.run(websockets.serve(ws_handler, "0.0.0.0", PORT))
|
loop = asyncio.new_event_loop()
|
||||||
|
asyncio.set_event_loop(loop)
|
||||||
|
loop.run_until_complete(websockets.serve(ws_handler, "0.0.0.0", PORT))
|
||||||
|
loop.run_forever()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user