robbiehanson / CocoaHTTPServer

A small, lightweight, embeddable HTTP server for Mac OS X or iOS applications
Other
5.6k stars 1.31k forks source link

How to use websocket to send message at any time? #179

Closed lantyu closed 7 years ago

lantyu commented 7 years ago

Hi As I tried this great project into my own program, I made a local server to communicate with my other components easily. But recently I'm in trouble. Because I want to send message from server to client by websocket. And refer to the demo, I think I has integrated the server. Client now can communicate with server by websocket now.

But the server can only send message by the callback functions.

And I tried to get the httpserver's all connections to run sendMessage for each. But it seems I can only get a nil.

I want to get some more information that can help me to understand how to send message from server to clinet proactively after websocket has connected.

Really thanks.