[Libwebsockets] callback pointer
treyweaver at fastmail.net
Fri May 14 21:23:15 CEST 2021
What is the best way to pass a pointer to a callback?
I want to set up a pointer to a class (i'm using c++) an retrieve that pointer when I get a callback.
I tried setting up the *protocols.user = this*;
And I tried:
*lws_context_creation_info.user = this;*
And then looked at the *user data on the call back, but the pointers did not match.
I then looked at using:
*lws_client_connect_info.opaque_user_data = this.*
and then use in the call back
This worked ok, and I probably could live with it but I miss the pointer for the first three messages when I set up the context and first connect
These are the message that have no value from: ws_get_opaque_user_data(wsi);
I was wondered if there was a better way.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libwebsockets