Spring Websocket 400 Error: Handshake failed due to invalid Upgrade header: null - spring

I am using wss (secured web sockets) with spring 4.2.x from backend and STOMP for javascript client. I can run it successfully under http, but failed when under https.
The only error I met is:
ERROR o.s.w.s.s.s.DefaultHandshakeHandler - Handshake failed due to invalid Upgrade header: null
The JS error is:
WebSocket connection to 'wss://.example.com/.../websocket' failed: Error during WebSocket handshake: Unexpected response code: 400
I googled a lot and understand that I should do some configuration on wildfly to make it support wss requests. But I don't know how. Thanks in advance if someone can give any idea!

Related

WebSocket React Native Invalid error: Invalid Sec-WebSocket-Accept response

I am receiving an Invalid Sec-WebSocket-Accept response when client (running on a simulator) tries to establish connection to the server. My server is written in Spring boot - java (websocket), client react native. I am using WebSocket to establish the connection to the server. This is what my client code looks like
const client = new WebSocketClient('ws://localhost:5000/websocket');
Result:
Event {
"isTrusted": false,
"message": "Invalid Sec-WebSocket-Accept response",
}
I have tried everything but I keep getting this error. I tested the connection to a mock server ws://echo.websocket.events/ and it works fine - I am confused on what I am doing wrong. I also tested this with ws://10.0.2.2:5000/websocket and i get
Event {
"isTrusted": false,
"message": "The operation couldn’t be completed. Connection refused",
}
help :)
NOTE: everything works fine on a browser

Websocket implementation not working in Apache Ofbiz

I am checking the Websocket implementation in Apache Ofbiz.
I followed the parent ticket OFBIZ-7073 and its child tickets.
But I am getting the following error-
ExamplePushNotifications.js:23 WebSocket connection to 'wss://localhost:8443/example/ws/pushNotifications' failed: Error during WebSocket handshake: Unexpected response code: 404
I think that the request is redirecting to control servlet rather than tomcat server. Therefore IMO, we need to make some changes in example/web.xml.
How should I proceed?
Thanks in advance!

WebSocket error 302, after composer update

Ratchet worked perfect until I updated my composer, after that it produce this error on chrome
WebSocket connection to 'wss://mysite.com/wss2/' failed: Error during WebSocket handshake: Unexpected response code: 302
on Mozilla
Firefox can’t establish a connection to the server at wss://mysite.com/wss2/.
httpd.conf
ProxyPass /wss2/ ws://myIP:8888/
socket.js
var conn = new ab.Session('wss://mysite.com/wss2/',
Does anyone know what might be the problem? thanks!

Strophe to Openfire: Error during WebSocket handshake: Unexpected response code: 302

I am writing a simple chat client (using strophe) which connects to my Openfire server. Strophe works successfully with BOSH, but for some reason cannot connect using websockets.
I have installed the latest version (websockets-0.0.0.6) of "WebSockets Plugin" plugin for OpenFire, using the default path "ws". My client url is ws://my-server:7070/ws.
I get the following error in my browser console:
WebSocket connection to 'ws://localhost:7070/ws' failed: Error during
WebSocket handshake: Unexpected response code: 302
I look at other related post (stackoverflow.com/questions/22983302/strophe-failed-to-connect-openfire-by-websocket) but have not been successful.
Has anyone come across this problem before?
Any help would really be appreciated.
Thanks in advance.
I'm assuming you were using the latest version of Strophe. The openfire-websocket is developed against with older version Strophe 1.0 . They are not capable now.
You can take a look at https://community.igniterealtime.org/thread/53783

Getting updates via xively websockets

I am trying to subscribe to datastream updates via the xively-js javascript library.
However, all I am getting is a 503 error right after creating the websocket:
WebSocket connection to 'ws://api.xively.com:8080/' failed: Unexpected response code: 503
The same error is produced by the xively-js sample-app at
http://xively.github.io/xively-js/sample-app/
Both IE10 and Chrome give the same result.
I can't seem to find any working xively websocket sample. Does somebody have any?
I have found the answer to my own question. It looks like non-secure websockets don't work for some reason.
The secure version wss://api.xively.com:8094 is working fine.

Resources