Skip to content

Code gets stuck if websocket connection dies at the same time as websocket.sendTXT #933

@JeffryCA

Description

@JeffryCA

I can consistently replicate the bug of the code getting "stuck" at websocket.sendTXT(...) if I sever the connection from the server side manually. It seems my users are having this problem. I already tried guardrails like:

...
if (!hasConnectedToWebSocket || !webSocket.isConnected()) {
    Serial.println("WebSocket not connected. Discarding data.");
    return;
  }
webSocket.sendTXT(data); // gets stuck here
...

Any idea on how to make this more robust / fail more gracefully?

Context:
My device is recording and sending chunks to the server as we record. The connection breaking during this process seems inevitable at some point or another (without me manually doing it to replicate the bug).

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