-
Notifications
You must be signed in to change notification settings - Fork 51
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
Error during WebSocket handshake: Unexpected response code: 400 #17
Comments
Please refer to WebSocket documentation on how to setup websocket handling. |
@trinopoty I tried both ways of implementation, but, I got the same 400 issues. The tomcat server didn't log the 400 request's trace. So, I can't able to close to the problem. |
Try setting breakpoints in the websocket handler. If that doesn't work, the request isn't reaching the server and the problem is elsewhere. |
Tomcat version: 9.x |
If the websocket handler is never being invoked, there's some problem in configuring tomcat. |
I tried with the normal WebSocket connection and It works. I found the below code in handleRequest method. Is this correct? I assumed that transport param accepts multiple values (websocket and polling). But, this check always checking polling content alone. In my client code, I passed the websocket string. The below always throw 400 error.
@trinopoty The given docs are not enough to use(even I can't make an upgrade the HttpRequest) and it really painful to understand the workflow. Can you please post sample code, at least the HelloWorld example. Curious to know, does anyone using this framework now? |
That is for the http request handling only. There's a separate handler for websocket connections named |
This code should work for tomcat.
Yes, I happen to be using this in a production environment right now. |
I'll try to get some examples included. |
@trinopoty Please check the below code that I have used handleWebsocket method. Now I getting different error,
Am I missed anything in the below code?
|
The mechanism for registering websocket endpoints are different than http endpoints. |
Dear @trinopoty I tried given code snippet. Yes, The code is working. The HTTP request has been upgraded. Thanks a lot. |
Dear @trinopoty After the setup the connection establishing works without error. But, the data transmission is not working. I enabled the client debugger and find the below log logs, engine.io.js:3394 engine.io-client:socket creating transport "websocket" +0ms
engine.io.js:3394 engine.io-client:socket setting transport websocket +27ms
engine.io.js:3394 engine.io-client:socket socket receive: type "error", data "parser error" +130ms
engine.io.js:3394 engine.io-client:socket socket error {"code":"parser error"} +1ms
engine.io.js:3394 engine.io-client:socket socket close with reason: "transport error" +1ms Any idea of the above error? |
"transport error" may be caused by connecting to websocket of a different protocol (not engine.io) or network issues. |
I have to use engine.io-server-java in my project. When I initiate the eio function, The request has failed and thrown 400 Bad requests. How do I debug this problem? Are there any documents available for engine.io-server-java?
Error
Request Header
Code:
Client Code:
The text was updated successfully, but these errors were encountered: