How to do a server side send without an inbound message

55 views
Skip to first unread message

Brad Taylor

unread,
Jan 19, 2024, 8:15:25 AMJan 19
to WebSocket++
I think what I want to do is allowed, but not sure how to do it.  After my server creates an endpoint and a web client connects,  When non web socket events occur in my server, I want to construct a message and send it to a the connected client, without the connect client first sending me a message.  
I used the echo server example as the basis for building my prototype code.  I already have a fairly complex server and want to be able to send notifications to connected clients.  Example would be most appreciated. 
Thank you

Peter Thorson

unread,
Jan 20, 2024, 5:34:50 AMJan 20
to Brad Taylor, WebSocket++
Hi Brad,

This is definitely allowed. The primary method is using endpoint.send with the connection_hdl for the connection you want to write to. The telemetry_server example demonstrates this.

Best,

Peter


On Jan 19, 2024, at 8:15 AM, Brad Taylor <cbrad...@gmail.com> wrote:

I think what I want to do is allowed, but not sure how to do it.  After my server creates an endpoint and a web client connects,  When non web socket events occur in my server, I want to construct a message and send it to a the connected client, without the connect client first sending me a message.  
I used the echo server example as the basis for building my prototype code.  I already have a fairly complex server and want to be able to send notifications to connected clients.  Example would be most appreciated. 
Thank you

--
You received this message because you are subscribed to the Google Groups "WebSocket++" group.
To unsubscribe from this group and stop receiving emails from it, send an email to websocketpp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/websocketpp/5b8fac98-d4d3-4cec-8dc3-ba96ded2bb5fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages