dpallot / simple-websocket-server

A python based websocket server that is simple and easy to use.
951 stars 321 forks source link

Dont use a forever blocking call #20

Closed ghost closed 9 years ago

ghost commented 9 years ago

When using a multithreaded setup (one thread running serverforever and one creating messages). The select call might hang endless preventing data being send.

I've created an optional parameter which creates a polling select call.

To use the non blocking select:

server = SimpleWebSocketServer("localhost", 9000, MyServerProtocol, selectInterval=0.01)
ghost commented 9 years ago

I've changed the default. Tho I'm unsure if setting it to None would break the code.

dpallot commented 9 years ago

I think you might be right, ive put your original commit in.