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

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

Open
wmSDevs opened this issue May 8, 2015 · 2 comments
Open

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

wmSDevs opened this issue May 8, 2015 · 2 comments

Comments

@wmSDevs
Copy link

wmSDevs commented May 8, 2015

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.

@hwilyric
Copy link

hwilyric commented Aug 2, 2017

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?

@ChrisInRedford
Copy link

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)

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

3 participants