[Libwebsockets] user data

Andy Green andy at warmcat.com
Thu Jan 16 17:14:49 CET 2020

On 1/16/20 4:06 PM, Peiffer Eric wrote:
> Hi,
> I'm writing a websocket server based on libwebsockets.
> I would like to know if there are an event that warms us that the data 
> pointed by user will be deallocated?

The CLOSE callback should happen to any connection that got as far as 
being ESTABLISHED... it's deallocated during the close flow that 
produces that callback.

For client connections it's possible to pass in your own user_data 
object and a second "opaque_user_data".  But for server, the wsi are 
generated when clients connect at their own whim, so the auto-allocated 
user data is convenient.


More information about the Libwebsockets mailing list