[Libwebsockets] Determining the protocol's name from within a callback

Drew Noakes drew at drewnoakes.com
Fri Apr 12 19:11:09 CEST 2013


Hi,

I'd like to reuse a callback across many protocols. I'm creating one
protocol for each of a number of entity in my system dynamically, removing
quite a bit of near-duplicated code.

Within the callback I'll need to know which protocol I'm being called back
for.

Can this be obtained from the wsi? I can't see how user session data would
help, as that's also initialised within the callback. libwebsocket.h only
provides a forward declaration for the wsi type, presumably to hide any
details of its internals.

Thanks in advance.

Drew.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20130412/88f18776/attachment.html>


More information about the Libwebsockets mailing list