On Fri, Aug 22, 2014 at 5:20 PM, Scott Ellis <[email protected]> wrote:

> Hi, I am curious, if the callback function you pass to
> mg_wakeup_server_ex() is called on every connection pointer that mongoose
> is holding, then how do you make sure the response you want to send goes to
> the correct connection?
> Thanks,
> Scott
>

Good question.

mg_wakeup_server_ex() is indeed a broadcast.

Usually a connection should have some marker. A marker could be stored in
mg_connection::connection_param pointer, which could be a pointer to a
structure. A marker should be set prior to broadcast.

In simplest cases, even marker is not required: for example, to push to all
websocket connections, mg_connection::is_websocket could be used as a
marker. That what Mongoose does when it sends periodic PING frames to all
websocket connections to keep them alive.

Sergey.

-- 
You received this message because you are subscribed to the Google Groups 
"mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to