I am using the Arduino Websocket Client library to connect my Arduino Uno to a Socket.IO server. But the connection always returns 0 (fail) after the handshake. Anyone has used this library before? How could I debug this?
#include "Arduino.h"
#include <Ethernet.h>
#include <SPI.h>
#include <WebSocketClient.h>
byte mac[] = {0xB8,0x27,0xEB,0x7E,0x2D,0xC9};
char server[] = "labathome.rexlab.ufsc.br";
int port = 8001;
WebSocketClient client;
void setup() {
Serial.begin(9600);
Ethernet.begin(mac);
Serial.println(client.connect(server, port));
client.setDataArrivedDelegate(dataArrived);
client.send("Hello World!");
}
void loop() {
client.monitor();
}
void dataArrived(WebSocketClient client, String data) {
Serial.println("Data Arrived: " + data);
}
PS: I tested the server and it works fine, and I also tested with a normal WS server instead of the Socket.IO, and nothing :(