Pithikos / python-websocket-server

A simple fully working websocket-server in Python with no external dependencies
MIT License
1.14k stars 381 forks source link

Service Actions #69

Closed Jawmo closed 5 years ago

Jawmo commented 5 years ago

Novice programmer here, sorry if it's a dumb question! I noticed that Websocket_server.service_actions() is looped over, so figure that I can use this as my loop to run a schedule or whatever else is needed.

The game I am creating requires a way to be checking things on a regular basis and then call whatever function is necessary to make things happen in the game.

Is there a way to use service_actions this way? I noticed that this loops over and over but the problem arises in that this method is inside the websocket code. The game code, in one way or another, imports the websocket into itself when the game starts so that I can access the Server.send_message or other functions. If I try to import any game files into the websocket, it obviously hits an infinite loop.

Is there something built-in to mediate this? I guess in other words... how do you get a game loop working between this websocket library and the game code?