[Libwebsockets] Denying a Connection

Andy Green andy at warmcat.com
Sat Apr 14 12:10:42 CEST 2018

On 04/14/2018 06:01 PM, Mooki Moo wrote:
> determine if a user’s connection request can continue. As part of this
> process I check to see if they are logged elsewhere and if this is the
> case I deny them.

LWS_WITH_PEER_LIMITS might be interesting then.

> However, regardless of my setting the lws_close_reason with an
> appropriate message (that I wanted to display in my Web UI) the JS
> 'debug" code tell me I always get a 1006 error code with no reason
> text.
> Can someone tell me the most elegant way I can do this please, so that
> I can propagate a message back to the user, to explain why they cannot
> connect.

... every ws connection starts as an http connection.

You are denying it - hanging up on it - before it actually upgraded into 
a ws connection.

So the browser doesn't know what to tell you... its ws connection 
attempt became a pupa that did not become as ws butterfly that can tell 
it why it wants to close using ws semantics.


>> Bill
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets

More information about the Libwebsockets mailing list