I am using Node.js eventsource with the AsyncEventSource plugin.
This works most of the time, but it some cases (mostly after doing a heavy POST request with some ArduinoJson), the timeout is triggered. This results in the client being disconnected.
The same happens with curl http://192.168.0.2/events.
My workaround is this:
http_events = new AsyncEventSource("/events");
http_events->onConnect([](AsyncEventSourceClient *client) {
debug("Client Connected");
// Disable ACK Timeouts. I don't know why these trigger,
// but they happen after doing a POST request — most of the time.
// Disabling timeouts altogether seems to work fine.
client->client()->onTimeout([](void *arg, AsyncClient *client, unsigned int time) {
debug("Client ACK Timeout");
});
This works, but of course isn't as elegant. I am not sure whether this is a bug, but wanted to let the developers know anyway. Maybe it's a known issue, or they can easily understand why it goes wrong.
I am using Node.js eventsource with the
AsyncEventSource
plugin.This works most of the time, but it some cases (mostly after doing a heavy POST request with some ArduinoJson), the timeout is triggered. This results in the client being disconnected.
The same happens with
curl http://192.168.0.2/events
.My workaround is this:
This works, but of course isn't as elegant. I am not sure whether this is a bug, but wanted to let the developers know anyway. Maybe it's a known issue, or they can easily understand why it goes wrong.