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

can't connect to wss:// protocol #1442

Closed
qblacksheep opened this Issue Jan 16, 2016 · 29 comments

Comments

Projects
None yet
6 participants
@qblacksheep

qblacksheep commented Jan 16, 2016

Hello,
at first i would like to say, im just started with ESP8266. I tried simple program form github:
https://github.com/morrissinger/ESP8266-Websocket/blob/master/examples/WebSocketClient_Demo/WebSocketClient_Demo.ino

When i am connecting with echo.websocket.org its working fine, i can send and read data from server. But i cant connect with server whose adress is: wss://example/device. Does anyone know the solution of this problem?

Thanks for help
Sorry for my english

@penfold42

This comment has been minimized.

Show comment
Hide comment
@penfold42

penfold42 Jan 16, 2016

Is the host "example" alive and dns resolvable on your network ?

penfold42 commented Jan 16, 2016

Is the host "example" alive and dns resolvable on your network ?

@marvinroger

This comment has been minimized.

Show comment
Hide comment
@marvinroger

marvinroger Jan 16, 2016

Contributor

Try replacing WiFiClient client; by WiFiClientSecure client;.

Contributor

marvinroger commented Jan 16, 2016

Try replacing WiFiClient client; by WiFiClientSecure client;.

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 16, 2016

Hi, thanks for help but i cant complie this Example.
blad

qblacksheep commented Jan 16, 2016

Hi, thanks for help but i cant complie this Example.
blad

@Links2004

This comment has been minimized.

Show comment
Hide comment
@Links2004

Links2004 Jan 16, 2016

Collaborator

you need the staring or git version of the ESP core

Collaborator

Links2004 commented Jan 16, 2016

you need the staring or git version of the ESP core

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 16, 2016

Thanks, its compiling now. But i still can't connect. In method webSocket.beginSSL should i write webSocket.beginSSL("wss://adress/device") or just webSocket.beginSSL("adress/device")? Defualt port is 443?

qblacksheep commented Jan 16, 2016

Thanks, its compiling now. But i still can't connect. In method webSocket.beginSSL should i write webSocket.beginSSL("wss://adress/device") or just webSocket.beginSSL("adress/device")? Defualt port is 443?

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 16, 2016

Do u know any test SSL server with can i test this program?

qblacksheep commented Jan 16, 2016

Do u know any test SSL server with can i test this program?

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 16, 2016

When i am trying to connect echo.websocket.org i get an exception: please start sntp first !

qblacksheep commented Jan 16, 2016

When i am trying to connect echo.websocket.org i get an exception: please start sntp first !

@igrr

This comment has been minimized.

Show comment
Hide comment
@igrr

igrr Jan 16, 2016

Member

This isn't an exception, just a debug message from the SDK. You can safely
ignore it.

If you are really getting an exception, it is likely unrelated to this
message.

On Sat, Jan 16, 2016, 22:27 qblacksheep notifications@github.com wrote:

When i am trying to connect echo.websocket.org i get an exception: please
start sntp first !


Reply to this email directly or view it on GitHub
#1442 (comment).

Member

igrr commented Jan 16, 2016

This isn't an exception, just a debug message from the SDK. You can safely
ignore it.

If you are really getting an exception, it is likely unrelated to this
message.

On Sat, Jan 16, 2016, 22:27 qblacksheep notifications@github.com wrote:

When i am trying to connect echo.websocket.org i get an exception: please
start sntp first !


Reply to this email directly or view it on GitHub
#1442 (comment).

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 16, 2016

Ok. But i still can't connect to any wss:// server. I was trying to connect to echo.websocket.org.
222

qblacksheep commented Jan 16, 2016

Ok. But i still can't connect to any wss:// server. I was trying to connect to echo.websocket.org.
222

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 16, 2016

. In method webSocket.beginSSL should i write webSocket.beginSSL("wss://echo.websocket.org") or just webSocket.beginSSL("echo.websocket.org")?

qblacksheep commented Jan 16, 2016

. In method webSocket.beginSSL should i write webSocket.beginSSL("wss://echo.websocket.org") or just webSocket.beginSSL("echo.websocket.org")?

@Links2004

This comment has been minimized.

Show comment
Hide comment
@Links2004

Links2004 Jan 16, 2016

Collaborator

webSocket.beginSSL("echo.websocket.org", 443);

Collaborator

Links2004 commented Jan 16, 2016

webSocket.beginSSL("echo.websocket.org", 443);

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 16, 2016

Now im getting this:
sss

qblacksheep commented Jan 16, 2016

Now im getting this:
sss

@Links2004

This comment has been minimized.

Show comment
Hide comment
@Links2004

Links2004 Jan 16, 2016

Collaborator

see: #1375
the Certificate size / key length is too big

Collaborator

Links2004 commented Jan 16, 2016

see: #1375
the Certificate size / key length is too big

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 16, 2016

Do you know any test SSL server with path where i can test websockets? i can't connect with my server maybe couse i have wss://webrouter.server/path. What do you think?

qblacksheep commented Jan 16, 2016

Do you know any test SSL server with path where i can test websockets? i can't connect with my server maybe couse i have wss://webrouter.server/path. What do you think?

@Links2004

This comment has been minimized.

Show comment
Hide comment
@Links2004

Links2004 Jan 16, 2016

Collaborator

webSocket.beginSSL("webrouter.server", 443, "/path");

Collaborator

Links2004 commented Jan 16, 2016

webSocket.beginSSL("webrouter.server", 443, "/path");

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 16, 2016

Thanks for help guys. But unfortunately i still can't connect to server. Has that debug message:: "please start sntp first !" have impact to conneting the server?
sssssss

qblacksheep commented Jan 16, 2016

Thanks for help guys. But unfortunately i still can't connect to server. Has that debug message:: "please start sntp first !" have impact to conneting the server?
sssssss

@Links2004

This comment has been minimized.

Show comment
Hide comment
@Links2004

Links2004 Jan 16, 2016

Collaborator

normally not.
add configTime(3 * 3600, 0, "pool.ntp.org", "time.nist.gov"); to the setup and it will be gone.
try to enable debug to see the reason for the disconnect.
https://github.com/Links2004/arduinoWebSockets/blob/master/src/WebSockets.h#L30

Collaborator

Links2004 commented Jan 16, 2016

normally not.
add configTime(3 * 3600, 0, "pool.ntp.org", "time.nist.gov"); to the setup and it will be gone.
try to enable debug to see the reason for the disconnect.
https://github.com/Links2004/arduinoWebSockets/blob/master/src/WebSockets.h#L30

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 17, 2016

bez tytulu

Is that client or server failure?

qblacksheep commented Jan 17, 2016

bez tytulu

Is that client or server failure?

@Links2004

This comment has been minimized.

Show comment
Hide comment
@Links2004

Links2004 Jan 17, 2016

Collaborator

the server returns 503 header so its a server problem, check the server logs.

Collaborator

Links2004 commented Jan 17, 2016

the server returns 503 header so its a server problem, check the server logs.

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 17, 2016

Thanks a lot! :)

qblacksheep commented Jan 17, 2016

Thanks a lot! :)

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 18, 2016

Did someone try to send and get ws from server on herokuapp.com? I can easily send and recive data on server which standing on local web but when i trying to connect to this same server standing on herokuapp.com its returns 503.

qblacksheep commented Jan 18, 2016

Did someone try to send and get ws from server on herokuapp.com? I can easily send and recive data on server which standing on local web but when i trying to connect to this same server standing on herokuapp.com its returns 503.

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 18, 2016

from server which i CAN connect i recive header connection:upgrade, from server which i CAN'T connect i recive header connection:keep-alive. How to change it? maybe there is a problem.

qblacksheep commented Jan 18, 2016

from server which i CAN connect i recive header connection:upgrade, from server which i CAN'T connect i recive header connection:keep-alive. How to change it? maybe there is a problem.

@Links2004

This comment has been minimized.

Show comment
Hide comment
@Links2004

Links2004 Jan 18, 2016

Collaborator

the server not accepts the WebSocket connection,
connection:upgrade is required for ws.
do your webserver really supports ws?
what software do you use as server?

https://tools.ietf.org/html/rfc6455#section-1.3

Collaborator

Links2004 commented Jan 18, 2016

the server not accepts the WebSocket connection,
connection:upgrade is required for ws.
do your webserver really supports ws?
what software do you use as server?

https://tools.ietf.org/html/rfc6455#section-1.3

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 18, 2016

I use Netty deployed on Heroku. Server logs are:
Exception caught in Netty
org.jboss.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Requested subprotocol(s) not supported: arduino

When I run server locally on Tomcat, it works fine

qblacksheep commented Jan 18, 2016

I use Netty deployed on Heroku. Server logs are:
Exception caught in Netty
org.jboss.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Requested subprotocol(s) not supported: arduino

When I run server locally on Tomcat, it works fine

@Links2004

This comment has been minimized.

Show comment
Hide comment
@Links2004

Links2004 Jan 18, 2016

Collaborator

Requested subprotocol(s) not supported: arduino
is a good hint.
the client sends:

Sec-WebSocket-Protocol: arduino

the Server seams to not accept this.
you can try to remove this line:
https://github.com/Links2004/arduinoWebSockets/blob/master/src/WebSocketsClient.cpp#L369
if its working i can a option to disable/override it, then you can add something your server allows.

Collaborator

Links2004 commented Jan 18, 2016

Requested subprotocol(s) not supported: arduino
is a good hint.
the client sends:

Sec-WebSocket-Protocol: arduino

the Server seams to not accept this.
you can try to remove this line:
https://github.com/Links2004/arduinoWebSockets/blob/master/src/WebSocketsClient.cpp#L369
if its working i can a option to disable/override it, then you can add something your server allows.

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 18, 2016

Its working now. Thanks a lot!!

qblacksheep commented Jan 18, 2016

Its working now. Thanks a lot!!

@qblacksheep

This comment has been minimized.

Show comment
Hide comment
@qblacksheep

qblacksheep Jan 18, 2016

It would be nice to have option to not include this header. Look at netty implementation http://netty.io/3.6/xref/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13.html
line 160-169. It throws exception only if there is unrecognized "Sec-WebSocket-Protocol" value. If there is no such header, netty uses default protocol and continues execution.

qblacksheep commented Jan 18, 2016

It would be nice to have option to not include this header. Look at netty implementation http://netty.io/3.6/xref/org/jboss/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13.html
line 160-169. It throws exception only if there is unrecognized "Sec-WebSocket-Protocol" value. If there is no such header, netty uses default protocol and continues execution.

@igrr igrr closed this Feb 29, 2016

@selvabha

This comment has been minimized.

Show comment
Hide comment
@selvabha

selvabha Dec 10, 2016

Hello All,
I am facing issues with web-sockets.My node MCU works as a web-socket client.It connects fine and able to do a bi-directional communication but after some time my client is dead silently without notification.

webSocket.beginSSL("YYYYYYYYYYYYYYYYYYYYYYYYY", 443, "/UUUUUUUUUUUUU");
webSocket.setAuthorization("CCCCCCCCCCCCCCCCCC");
webSocket.onEvent(webSocketEvent);

in the loop()
{
I was listening for the websocket event in the loop
}

even though it fails silently without notification. I am in the last phase of the project with a big issue.Please throw some light.

selvabha commented Dec 10, 2016

Hello All,
I am facing issues with web-sockets.My node MCU works as a web-socket client.It connects fine and able to do a bi-directional communication but after some time my client is dead silently without notification.

webSocket.beginSSL("YYYYYYYYYYYYYYYYYYYYYYYYY", 443, "/UUUUUUUUUUUUU");
webSocket.setAuthorization("CCCCCCCCCCCCCCCCCC");
webSocket.onEvent(webSocketEvent);

in the loop()
{
I was listening for the websocket event in the loop
}

even though it fails silently without notification. I am in the last phase of the project with a big issue.Please throw some light.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment