Hi -
I am using the libray ArduinoHttpClient library 0.3.1 for its websocket functionality.
There is a nodejs websocket server sending a json message every 5 seconds or so to a mkr1010 .
The arduino code below checks the websocket client every 250ms (timed by an interrupt) and I then just print the message.
Periodically the arduino receives this type of message:
-WebSocket-Accept: IITLDv8iKA224HKPdqHoDvdkhWQ=
Sec-WebSocket-Protocol
(often truncated or pieces are garbled)
...which looks very much like a server request to the arduino http client requesting a websocket upgrade even though the websocket is already connected and running.
The nodejs websocket server then kills the connection with the error message: 1006 Socket Error: read ECONNRESET. And finally the arduino serial port seems to lock up and I have to repower it.
Can anybody suggest where to look to find out what this is and how to fix it?
Thanks, John.
void TC5_Handler (void) {
if (client.connected()) {
int messageSize = client.parseMessage();
if (messageSize > 0) {
tmpMessage = client.readString();
tempMsg = true;
}
}
}
void loop() {
if (tempMsg) {
Serial.println(millis());
Serial.println(tmpMessage);
tempMsg = false;
}
}