You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Instability on WSS Connections, only works when one client abandon connection #466
hello, im implementing a simple secure websocket server and client. My server implementation is the same as provided in the example folders, and im using websocket.org to test this implementation (http://www.websocket.org/echo.html). I can connect using WSS. However, to do so, i need to request connection on thwo tabs, and close one of them. The other then, connects perfectly. If i dont close one of the tabs, all connections timeout. The server does not give me any exceptions on console not when it connects nor when it cant.
I dont have many experience with WSS. However, WS implementaton works out of the box with this same server.
For my experience, seems like a endless loop is created when i try to connect. And only breaks when i kill one of the tabs trying to connect.
For the record, im using version 1.3.3
Can you help me out pls?! =*
EDIT -
Hello again, im posting a sample project to illustrate my problem. With this project is my keystore.jks.
The password for the keystore is password and the password for the key is password, as shown on my source.
Im using firefox 53.0 (32bits) for my tests. and i already have gone to https://localhost:8283 and accepted my certificate.
What i cant understand is that if the problem is with my certificate, why some times it can connect correctly?
The client im testig with is from websocket.org. it is on this link: http://www.websocket.org/echo.html.
Can you tell me step by step how i must configure my setup so it works for me too?
this is interesting. This problem occurs for me as well in firefox, but not in chrome.
It is also limited to localhost, since I was able to connect to my production wss.
Just to clear some things up, your client is firefox.
The websocket.org website just provides an easy interface for the javascript implementation below.
Gonna test it against other implementations of websocket servers and gonna keep you updated.
Thank you again for your immediate response! This is really getting interesting.
Im getting a Let's Encrypt certificate for my production domain, and so ill try to apply it to a test server on a subdomain there...
I hope it works...
as mentioned above, do you really need tcpNoDelay set?
It does cause additional stress for the cpu and network, and I think it could be the main reason for the problems.
It is the only difference between your and my server.
I have disabled TCPNoDelay on the chatserver at my domain.
However, my problems with Firefox and other naughty browsers other than chrome keep happening.
In Firefox, if i connect, disconnect and try to reconnect, it just does nothing for a while, then times out.
Hey guys, I've test this issue using websocket.org with a netty websocket server, it works fine with firefox as the same as chrome. I believe this problem has nothing to do with the self-signed certificate.
Since it's sometimes failed to connect to server due to timeout, is it possible that this problem was caused by some resources leak?
@zhoulifu , thank you for the advice.
I'll take a look at netty lib. However a already have made a cross-solution, proxying wss:// to ws:// in apache server, this way i can still have a https connection and a ws one.
@Irahe Glad to hear you've solved your problem.
But it will have performance effect I think because apache needs to hold extra socket for every ws connection. Just mentioning :)
Check out http://stackoverflow.com/a/30760134 for a more detail explanation.
TL;DR java doesn't support TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 and firefox requests this.
you can build the jar directly from the sources.
1.3.4 will not be around for at least the next 2 weeks probably a bit more. (Don't wanna go be at version 1.33.7 at the end of the year ;) )
The changes needed are already at the source in here( https://github.com/TooTallNate/Java-WebSocket) or i should go to your personal fork at (https://github.com/marci4/Java-WebSocket-Dev)?
Thank you for your help!
I just imported the new lib into my mais project and it worked like a champ!
You can tag this issue as FIXED LIKE A BOSS... XD
Activity
marci4 commentedon May 2, 2017
Hello @Irahe,
I just tested your problem with my wss which I use in production and the issue mentioned does not occur for me.
Going to look into your sample project.
Til then, could you please tell me which clients you use? (so which browser)
Greetings
marci4
marci4 commentedon May 2, 2017
Hello @Irahe,
I looked into your project and for me it works fine.
The problem may be your self signed certificate.
Did you go to
https://localhost:8283and told your browser to trust the certificate? (wss server has to run)Greetings
marci4
Irahe commentedon May 2, 2017
Hello @marci4 , thank you for your fast response!
Im using firefox 53.0 (32bits) for my tests. and i already have gone to https://localhost:8283 and accepted my certificate.
What i cant understand is that if the problem is with my certificate, why some times it can connect correctly?
The client im testig with is from websocket.org. it is on this link:
http://www.websocket.org/echo.html.Can you tell me step by step how i must configure my setup so it works for me too?
Thank you =*
marci4 commentedon May 2, 2017
Hello @Irahe,
this is interesting. This problem occurs for me as well in firefox, but not in chrome.
It is also limited to localhost, since I was able to connect to my production wss.
Just to clear some things up, your client is firefox.
The websocket.org website just provides an easy interface for the javascript implementation below.
Gonna test it against other implementations of websocket servers and gonna keep you updated.
Greetings
marci4
Irahe commentedon May 2, 2017
Hello there, @marci4 ,
Thank you again for your immediate response! This is really getting interesting.
Im getting a Let's Encrypt certificate for my production domain, and so ill try to apply it to a test server on a subdomain there...
I hope it works...
I keep you posted!
Best wishes,
Irahe Kasprzykowski.
marci4 commentedon May 2, 2017
Ok here is my current status:
SSC = Self signed certificate
LE = Let's Encrypt
Test case echo.websocket.org SSC:
Test case local file SSC:
Test case local file LE:
Having TcpNoDelay set to false!
I also was able to connect to your server without problems.
Do you really need TCP_NODELAY set to true?
Greetings
marci4
marci4 commentedon May 2, 2017
Hello @Irahe,
as mentioned above, do you really need tcpNoDelay set?
It does cause additional stress for the cpu and network, and I think it could be the main reason for the problems.
It is the only difference between your and my server.
Greetings
marci4
Irahe commentedon May 2, 2017
Hi, @marci4 ,
I have disabled TCPNoDelay on the chatserver at my domain.
However, my problems with Firefox and other naughty browsers other than chrome keep happening.
In Firefox, if i connect, disconnect and try to reconnect, it just does nothing for a while, then times out.
Why is Firefox so unrighteous? LOL...
Greetings,
Irahe Kasprzykowski
zhoulifu commentedon May 3, 2017
Hey guys, I've test this issue using websocket.org with a netty websocket server, it works fine with firefox as the same as chrome. I believe this problem has nothing to do with the self-signed certificate.
Since it's sometimes failed to connect to server due to timeout, is it possible that this problem was caused by some resources leak?
Irahe commentedon May 3, 2017
@zhoulifu , thank you for the advice.
I'll take a look at netty lib. However a already have made a cross-solution, proxying wss:// to ws:// in apache server, this way i can still have a https connection and a ws one.
=D
zhoulifu commentedon May 3, 2017
@Irahe Glad to hear you've solved your problem.
But it will have performance effect I think because apache needs to hold extra socket for every ws connection. Just mentioning :)
marci4 commentedon May 3, 2017
Could be related to #385 and #160
marci4 commentedon May 3, 2017
It actually is related to #385.
Check out http://stackoverflow.com/a/30760134 for a more detail explanation.
TL;DR java doesn't support
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256and firefox requests this.I quess I gonna patch this directly.
Greetings
marci4
Fix for TooTallNate#466
Merge pull request #472 from marci4/master
Irahe commentedon May 3, 2017
@marci4 , FANTASTIC!
The 1.3.4 is already available? I can just download the source and rebuild?
Thank you guys again!
Irahe Kasprzykowski
marci4 commentedon May 3, 2017
Hello @Irahe,
you can build the jar directly from the sources.
1.3.4 will not be around for at least the next 2 weeks probably a bit more. (Don't wanna go be at version 1.33.7 at the end of the year ;) )
Greetings
marci4
Irahe commentedon May 3, 2017
@marci4 ,
The changes needed are already at the source in here(
https://github.com/TooTallNate/Java-WebSocket) or i should go to your personal fork at (https://github.com/marci4/Java-WebSocket-Dev)?Thanks,
I hope the 2.0 reaches us soon! =D
marci4 commentedon May 3, 2017
Hello @Irahe,
no I already merged them into this repository.
hahaha probably not ;)
Irahe commentedon May 3, 2017
@marci4 and @zhoulifu ,
Thank you for your help!
I just imported the new lib into my mais project and it worked like a champ!
You can tag this issue as FIXED LIKE A BOSS... XD
tausend dank!,Irahe Kasprzykowski
marci4 commentedon May 3, 2017
Happy to hear that!
Closing issue.
Greetings
marci4