main.py 427 B

1234567891011121314151617
  1. import threading
  2. import asyncio
  3. from ws_client import start_ws_clients, stop_all_threads
  4. from ws_server import start_websocket_server
  5. import warnings
  6. # 忽略 FutureWarning
  7. warnings.simplefilter(action='ignore', category=FutureWarning)
  8. # 启动 WebSocket 客户端
  9. start_ws_clients()
  10. # 启动 WebSocket 服务器
  11. asyncio.run(start_websocket_server())
  12. # 停止所有线程(在需要停止时调用)
  13. # stop_all_threads()