def _ws_connect(self):
# Initialize websocket parameters
self.wsa = websocket.WebSocketApp(
url=self.ws_url,
on_message=self._server_response,
on_error=self._ws_error,
on_open=self._ws_open,
on_close=self._ws_close)
# Run the websocket in parallel thread
self.wsa_thread = threading.Thread(
target=self.wsa.run_forever,
name='WSA-Thread')
self.wsa_thread.setDaemon(True)
self.wsa_thread.start()
评论列表
文章目录