8000 SOLVED: Works when debug enabled, Disconnects when debug disabled. · Issue #316 · Links2004/arduinoWebSockets · GitHub
[go: up one dir, main page]

Skip to content
SOLVED: Works when debug enabled, Disconnects when debug disabled.  #316
@brendanmatkin

Description

@brendanmatkin

With no debug port set, my esp8266 connects to a processing-based server (it is not a very robust library but normally works fine for simple stuff). The esp is listening for Server Message and replies with a small JSON. Every time it sends 2 messages successfully, then disconnects and stays disc 6837 onnected until I reset the ESP (I set reconnect interval to 5000 so it throws a WStype_DISCONNECTED every 5 seconds). I'm also sending a ping manually every 60 seconds.

TWIST: If I set the debug port in IDE to Serial to output debug, it works every time. Obviously this makes it difficult to figure out what's happening! Any ideas? Is something critical happening in the debug that is not normally happening?

Here is some debug output of it working:

[WS][0][sendFrame] sending Frame Done (3547us).
[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 513759
[WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1
[WS][0][handleWebsocket] ------- read massage frame -------
[WS][0][handleWebsocket] fin: 1 rsv1: 0 rsv2: 0 rsv3 0  opCode: 1
[WS][0][handleWebsocket] mask: 0 payloadLen: 14
[readCb] n: 14 t: 513774
[WS][0][handleWebsocket] text: Server message
[ws] got text: Server message
{"id":128,"battery":4.033936}
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 1 mask: 1 length: 29 headerToPayload: 0
[WS][0][sendFrame] text: {"id":128,"battery":4.033936}
[WS][0][sendFrame] pack to one TCP package...
[write] n: 35 t: 513805
[WS][0][sendFrame] sending Frame Done (3994us).

And with a ping/pong in the middle:

[WS][0][sendFrame] sending Frame Done (2879us).
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 9 mask: 1 length: 0 headerToPayload: 0
[write] n: 6 t: 480056
[WS][0][sendFrame] sending Frame Done (2134us).
[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 480068
[WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1
[WS][0][handleWebsocket] ------- read massage frame -------
[WS][0][handleWebsocket] fin: 1 rsv1: 0 rsv2: 0 rsv3 0  opCode: 10
[WS][0][handleWebsocket] mask: 0 payloadLen: 0
[WS][0][handleWebsocket] get pong ()
[WS][0][handleWebsocketWaitFor] size: 2 cWsRXsize: 0
[readCb] n: 2 t: 483694
[WS][0][handleWebsocketWaitFor][readCb] size: 2 ok: 1
[WS][0][handleWebsocket] ------- read massage frame -------
[WS][0][handleWebsocket] fin: 1 rsv1: 0 rsv2: 0 rsv3 0  opCode: 1
[WS][0][handleWebsocket] mask: 0 payloadLen: 14
[readCb] n: 14 t: 483709
[WS][0][handleWebsocket] text: Server message
[ws] got text: Server message
{"id":128,"battery":4.033936}
[WS][0][sendFrame] ------- send message frame -------
[WS][0][sendFrame] fin: 1 opCode: 1 mask: 1 length: 29 headerToPayload: 0
[WS][0][sendFrame] text: {"id":128,"battery":4.033936}
[WS][0][sendFrame] pack to one TCP package...
[write] n: 35 t: 483740
[WS][0][sendFrame] sending Frame Done (3470us).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0