[Libwebsockets] Using protocols not passed to lws_create_context()

Zevv libws at zevv.nl
Tue Jan 14 12:06:36 CET 2020

Hi list,

I'm in the process of migrating an propriatary application with a custom
http socket layer to libws. There are a number of different websocket
client modules in different parts of the code, and I'd like to keep
those logically separated.

My problem is that all the lws_protocols are defined at the lws_context
level, so I'm not able to define a protocol in a local source file only,
as they all need to be registered in one central place to the
lws_context at lws_create_context() time.

My current workaround is to create multiple lws_contexts in separate
modules, but this is of course not the right way to go.

Is it possible to bind a protocol and/or wsi callback on a wsi without
having to define these when creating the lws_context?

Thank you,


More information about the Libwebsockets mailing list