ArduinoWebsocketClient icon indicating copy to clipboard operation
ArduinoWebsocketClient copied to clipboard

Help please! can't connect to my java websocket server

Open wmSDevs opened this issue 10 years ago • 2 comments

Hi, I have a java websocket server with multiple websocket endpoints, each one with a specific location in LAN. example:

http://[my local ip]:[port]/myJavaApp/webSocket1 http://[my local ip]:[port]/myJavaApp/webSocket2 http://[my local ip]:[port]/myJavaApp/webSocket3 etc..

The example sketch is working fine with "echo.websocket.org", but I just cant connect to my websocket server endpoints.

That's what I'm trying...

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; char server[] = "[my local ip]:[port]/myJavaApp/webSocket1"; WebSocketClient client;

void setup() { Serial.begin(9600); Ethernet.begin(mac); client.connect(server); client.setDataArrivedDelegate(dataArrived); client.send("Hello World!"); }

void loop() { client.monitor(); }

void dataArrived(WebSocketClient client, String data) { Serial.println("Data Arrived: " + data); }

Also I have tried with client.connect(server,port); but I don't know how to indicate the /myJavaApp/webSocket1 location.

I know my java server is ok because I can use Javascript clients and all is working fine. I hope you can help me, I think is just about setup.

wmSDevs avatar May 08 '15 19:05 wmSDevs

Same here, I tried to connect echo.websocket.org using WIFI shield. but even connecting to echo.websocket.org didn't succeed.(not handshake) Any help?

hwilyric avatar Aug 02 '17 03:08 hwilyric

In WebSocketClient::Connect, There are 3 parameters. WebSocketClient::connect(char hostname[], char path[], int port) My best guess is

char hostname[] = "myHostName";
char pathname[] = "//myJavaApp//webSocket1";
int port = 9983;
client.connect(hostname, pathname, port)

ChrisInRedford avatar Dec 27 '18 07:12 ChrisInRedford