[Libwebsockets] user data

Peiffer Eric eric.peiffer at al-enterprise.com
Thu Jan 16 17:06:56 CET 2020


I'm writing a websocket server based on libwebsockets.

my protcols array look like this:

static struct lws_protocols protocols[] = {
        {NULL, NULL, 0, 0} /* terminator */

where the XMPP protocol is:

    { \
        "xmpp", \
        callback_xmpp, \
        sizeof(WebSocketInstance), \
        0, \
        0, NULL, 0 \

WebSocketInstance is a C++ class that holds connection data.

in the callback_xmpp I have the following code in order to retreive user data stored in the WebSocketInstance class:

int callback_xmpp(struct lws *wsi, enum lws_callback_reasons reason,
                  void *user, void *in, size_t len) {
    try {

        WebSocketInstance * connection =
                (WebSocketInstance *)user;


I would like to know if there are an event that warms us that the data pointed by user will be deallocated?



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20200116/2940c45c/attachment.htm>

More information about the Libwebsockets mailing list