[Libwebsockets] Some help wanted explaining how the dumb-increment-protocol works
andy at warmcat.com
Sun May 15 01:05:20 CEST 2016
On May 15, 2016 2:20:01 AM GMT+08:00, Colin Adams <colinpauladams at gmail.com> wrote:
>On Sun, 8 May 2016 at 22:06 Andy Green <andy at warmcat.com> wrote:
>> >looking at test-server-dumb-increment.c as an implementation
>> >I've got this roughly 1/4 working. Only one
>> It sounds like you are not generating
>> lws_callback_on_writable_all_protocol() to regulate those callbacks.
>Got that fixed by determinedly hacking at idris to get plugins to work.
Good... going on, all new protocol things from us will be leveraging the plugins.
>> >gets seen by my handler, and debugging shows it writes one byte (a
>> OK... if by 'write' we mean calls lws_write()
>> >successfully, But the number doesn't get displayed in the web page.
>> >request Server Close button DOES work (debugging shows my handler
>> >the message, but it never receives a reset\n message when I press
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 it'd be interesting to check with tcpdump -s0 -X what happened on the wire.
And maybe open the js console on the browser for clues.
>> Sounds like your code for sending stuff has something wrong.
>Indeed. And yet ...
> lws_write is returning the correct number of bytes written, and also
>I am now receiving the reset request and close request properly, and
What was wrong with that, that it's fixed now?
>issuing an lws_close_reason, but that too isn't working. No doubt these
>facts are closely related.
Yeah it's related to lws_write() again.
- monitor the wire with tcpdump (disable ssl and extensions so you can see the data, +/- ws mandated xoringon packets from the client)
- check the libuv timer dumb increment plugin sets up for himself is firing
- put logging inside output.c / lws_write to confirm write() happens
>I'm really writing this email in the hope of clarifying my thoughts on
>problem, but nothing's sparked into my brain in the act of writing it,
>I'll send it anyway. I dare say the answer will come to me soon.
More information about the Libwebsockets