websocket-client: Is there a way to run WebsocketApp.run_forever without blocking program?

I’m making a module for adding multiplayer functionality to python games and am using this module and the websocket-server module for adding the option to communicate via websockets. I use self.server = websocket.WebSocketApp(main_server, on_message=self.on_message) to connect and try to use self.server.run_forever. But if I do, my program just hangs at that line. I need to send data after this so it doesn’t work. If I exclude it, then when I try to send data it just gives me the Connection already closed error. I have tried using the threading module and multiprocessing module but neither work.

All code can be found here.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 25 (2 by maintainers)

Most upvoted comments

@bubbleboy14 I’ve fixed it now. Thanks so much for helping me.