[Libwebsockets] [libwebsockets] #15: Removal of public close...

Trac trac at libwebsockets.org
Fri Feb 15 15:24:54 CET 2013

#15: Removal of public close...
  Reporter:  Joakim                 |      Owner:  agreen
      Type:  defect                 |     Status:  new
  Priority:  major                  |  Milestone:
 Component:  libwebsockets library  |    Version:
Resolution:                         |   Keywords:

Comment (by Joakim):

 Passing the socket via the '''in''' argument is more consistent, that's a
 better solution.

 Also, the user context is not always malloc'd by the library, I prefer to
 use the '''libwebsocket_connect_extended''' which takes an optional user
 context as argument. I then set the size to 0 in the protocols struct. In
 this way, the lib will never try to free my user context.

 In this way I can keep a reference to the websocket session + libwebsocket
 global context in my own allocated user context, instead of in global
 variables. I can then pass this context around in my functions, in a clean
 way. That's why I'm keen on always being given this context in the

 I'm not getting a close callback when returning -1 after my pong timed out
 in the writable callback. So now I resorted to using
 '''libwebsocket_get_socket_fd(wsi)''' to get the socket and doing a
 shutdown/close on it, which works consistently.

Ticket URL: <http://libwebsockets.org/trac/ticket/15#comment:12>
libwebsockets <http://libwebsockets.org>
libwebsockets C library

More information about the Libwebsockets mailing list