Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Async with Socket.IO disconnects and reconnects repeatedly #858

Open
LacombeJ opened this issue Dec 19, 2023 · 1 comment
Open

Async with Socket.IO disconnects and reconnects repeatedly #858

LacombeJ opened this issue Dec 19, 2023 · 1 comment

Comments

@LacombeJ
Copy link

Enabling async with socket.io causes repeated disconnects and reconnects. Without async this works fine but my issue was that the program was delaying every 5 seconds if connection wasn't found. I believe the issue has to do with the code below. I noticed that cSessionId is empty (in both sync and async) at first but during sync, this value is somehow re-read below. But in async, the cSessionId is never set.

#if(WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC)
        } else if(client->isSocketIO) {
            if(client->cSessionId.length() > 0) {
                DEBUG_WEBSOCKETS("[WS-Client][handleHeader] found cSessionId\n");
                if(clientIsConnected(client) && _client.tcp->available()) {
                    // read not needed data
                    DEBUG_WEBSOCKETS("[WS-Client][handleHeader] still data in buffer (%d), clean up.\n", _client.tcp->available());
                    while(_client.tcp->available() > 0) {
                        _client.tcp->read();
                    }
                }
                sendHeader(client);
            }
#endif

Maybe the issue is something else, but this is part of the error I am seeing with async on:

[WS-Client][handleHeader]  - cSessionId: 
[WS-Client][handleHeader] still missing cSessionId try socket.io V3
[WS-Server][0] Disconnect client
[WS-Client] asyncConnect...

And with sync:

[WS-Client][handleHeader]  - cSessionId: 
[WS-Client][handleHeader] still missing cSessionId try socket.io V3
[WS-Client][handleHeader] socket.io json: 118:0{"sid":"VddgreoCPZTlh1YyAAE9","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":20000,"maxPayload":1000000}
[WS-Client][handleHeader]  - cSessionId: VddgreoCPZTlh1YyAAE9
[WS-Client][handleHeader] Header read fin.
@guotingchao
Copy link

same probleam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants