[Libwebsockets] Some help wanted explaining how the dumb-increment-protocol works

Colin Adams colinpauladams at gmail.com
Sun May 15 12:12:27 CEST 2016

On Sun, 15 May 2016 at 00:05 Andy Green <andy at warmcat.com> wrote:

> > >request Server Close button DOES work (debugging shows my handler
> >> >receives
> >> >the message, but it never receives a reset\n message when I press
> >the
> That's pretty confusing actually, if I understood it both buttons send
> something but only one makes it to the RECEIVE.  And both those cases are
> dumb-increment (close test reuses a second dumb increment connection).

I think I inadvertently left tact in from an older message in this thread.
Both reset and closeme requests reach my server.

I think it'd be interesting to check with tcpdump -s0 -X what happened on
> the wire.

That was a useful tip. As a result, I have now got lws_write working
correctly (just a silly error on my part).

> >issuing an lws_close_reason, but that too isn't working. No doubt these
> >two
> >facts are closely related.
> Yeah it's related to lws_write() again.

Apparently not, as that works now, but lws_close_reason does not.

I added the following statement at the beginning of lws_close_reason:

printf ("Status is %i, message is %s, length is %u\n", status, buf,
(unsigned int) len);

and I get identical output from both the distributed C example, and my
idris version.

I'm suspecting it's due to being on a second connection. One thing I DO see
that is different between the output of the two implementations (not
related to lws_close_reason, apparently, as it occurs before that, but
might give me a clue), is the following. Your C implementation puts out the
following lines:

lwsts[10999]:  permessage-deflate requires the protocol
(dumb-increment-protocol) to have an RX buffer >= 128
lwsts[10999]: ext permessage-deflate failed construction
lwsts[10999]:  Capping pmd rx to 128
lwsts[10999]: cache_len 313
lwsts[10999]:  Capping pmd rx to 128

But when I run my implementation, I only see the first two lines, not the
last three (same debug level). Are those last three lines relating to the
other plugins (I've only tried implementing the dumb-increment one so far -
one step at a time)?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20160515/f295e5f5/attachment-0001.html>

More information about the Libwebsockets mailing list