I would like to send information to a client via a Websocket. So far I have only been able to do that when a client contact the server, i.e. the server is able to respond via the socket connection that the client has created.
If the client keep the socket connection, which it does in my implementation, I would like to be able to send information to the client due to server side events, e.g. something happens at the server and it would like to send information to the client. Then I assume that I would need to have a reference to the socket in the server. I also assume that this reference would need to be declared as separate.
My problem is that I can not find where a new socket connection is created in the server. Can you direct me to that point in the code and maybe describe how I can refer to that web_socket/web_socket_handler or any other separate object that I can save for future use, just in case the server want to send something to the client.
My current solution is to let the client poll for information which will both be too time consuming and will use a lot of memory at the server.