-
-
Notifications
You must be signed in to change notification settings - Fork 756
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
native socket.io demo doesn't use websocket if nio configured in Tomcat 7 #885
Comments
A little extra info... my initial tests were on 7.0.32. I just found the following bug that could have been causing an issue https://issues.apache.org/bugzilla/show_bug.cgi?id=54067 as I saw the erroneous header in the Network log. I have now repeated the test on 7.0.35 The websocket response now no longer includes the Transfer-Encoding header but the chat still falls over to xhr-polling. |
I have also tried upgrading the socket.io client library to 0.9.11, this also had no effect. |
If I'm interpreting the output in the Network pane correctly, then the issue seems to be that when using nio all of the headers for the 101 response are correct but the initial frame "1::" is never sent from the server when it is a websocket connection ... or at least is never received by the client. |
As mentioned on the mailing list. This issue also affects the regular socket.io chat sample. |
I'm sorry that I wasn't more active on Atmosphere and socket.io lately. I I'll take a lot to fix socket.io samples with Tomcat 7 and websocket. 2013/2/2 Jonathan Share [email protected]
A+ Sébastien. Vous pouvez me suivre sur Twitter / You can follow me on Twitter : |
I try with atmosphere extension 1.10-snapshot and tomcat 7.0.35 and Firefox. The websocket are working 200 OK xhr.responseText=50A7110D668C8C4403B6AED5823021B62922EC7B:15000:25000:websocket,xhr-polling,jsonp-polling socket.io.js (ligne 1629) WS open url=ws://localhost:8080/atmosphere-nativesocketio-chat-1.1.0-SNAPSHOT/ChatAtmosphereHandler/1/websocket/50A7110D668C8C4403B6AED5823021B62922EC7B socket.io.js (ligne 2327) parser.decodePacket data=1:: socket.io.js (ligne 1120) [ "websocket" , "xhr-polling" , "jsonp-polling" ] /atmos...APSHOT/ (ligne 29) WS sending=5:1+::{"name":"nickname","args":["test"]} socket.io.js (ligne 2357) parser.decodePacket data=6:::1+[false] socket.io.js (ligne 1120) 2013/2/2 Sebastien Dionne [email protected]
A+ Sébastien. Vous pouvez me suivre sur Twitter / You can follow me on Twitter : |
Strange, can you attach/gist your tomcat server.xml so I can see how you have nio configured? The sample also works fine for me with bio, the issue only comes with nio. On Feb 3, 2013, at 2:08 PM, Sebastien Dionne wrote:
|
I use the default config from a fresh download on tomcat. I just put the sample. War into webapps folder of the tomcat that I
|
Then you are not using the nio connector, and therefore not running a scalable system at all... Replace With You will also need to add a context.xml to the project (see other samples) in order for atmosphere to select the nio implementation instead of falling back to bio. On Feb 3, 2013, at 5:46 PM, Sebastien Dionne wrote:
|
please change the label issue. It's not related to socket.io. I'll let 2013/2/3 Jonathan Share [email protected]
A+ Sébastien. Vous pouvez me suivre sur Twitter / You can follow me on Twitter : |
Fixed in 1.0.11 |
Not sure that was an improvement :) I pulled the latest code, and now, instead of falling back to polling the call to http://localhost:8081/atmosphere-nativesocketio-chat/ChatAtmosphereHandler/1/?t=1361478235835 received the following error java.lang.NullPointerException Looking in the logs I got the following... 511 [localhost-startStop-2] INFO org.atmosphere.cpr.AtmosphereFramework - Installed AtmosphereInterceptor SocketIO-Support. I can take a closer look tomorrow, but all I did now compared to earlier tests was to do git pull && mvn clean install then copied over the correct war to tomcat. |
Use the 1.0.x branch, the master is not stable |
Also,
EventCacheBroadcasterCache has been renamed to UUIDBroadcasterCache so that could explain your error. |
I'm on the 1.0.x branch
|
Something is broken in your env. Just re-tested with both master and 1.0.x and both works fine :-) |
Sorry, yes, you are right. I had messed with the broadcaster cache settings locally when trying to debug the issue originally. Thatnks a lot, looks like it works well now :) |
Is this broken again? I am seeing StackOverflowError on page load. (I am running socketio-chat example.) Nov 1, 2013 1:11:09 PM org.apache.tomcat.util.net.NioEndpoint$SocketProcessor run How to Reproduce A. Download Tomcat 7.0.25 (or 7.0.42)
C. Do Not Add META-INF/context.xml E. as soon as you hit the index.html, you get StackOverflowError (Test with Chrome 22.0) |
Steps to reproduce
Expected result
socket.io should successfully negotiate a websocket connection as it does when using bio
Actual result
I've not checked with Wireshark what is actually happening over the network but the network log in chrome shows that the socket.io performs a fallback to xhr-polling. I have attempted to turn on all possible logging both within the app and in tomcat, nothing appears that would indicate any kind of error.
The text was updated successfully, but these errors were encountered: