dpallot / simple-websocket-server

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

Send message to client without having to receive one first #6

Closed adammhaile closed 10 years ago

adammhaile commented 10 years ago

I'd like to use your websocket implementation but my use-case might be a little weird. Basically I want the webpage to connect to a server started by a script I have that is generating data. As that data is generated, I need to send it to the connected client (there should only ever be one). But from your examples I only see that you can call sendMessage in response to something. I tried to send the server off on it's own thread and call sendMessage from outside of that but it just errors saying that sendMessage is unbound.

Any thoughts?

dpallot commented 10 years ago

Not sure I fully understand your situation. Is the web client that is generating the data wanting to transmit that data to another web client or just to the server?