Can't connect strophe to Openfire via Websockets (Error during WebSocket handshake)

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- 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://’ failed: Error during WebSocket handshake: Unexpected response code: 404

Has anyone come across this problem before?

Any help would really be appreciated.

Thanks in advance.

Update: After restarting openfire server I now get the following:

WebSocket connection to ‘ws://’ failed: Error during WebSocket handshake: Unexpected response code: 302


GET http://localhost:7070/ws HTTP/1.1

Upgrade: websocket

Connection: Upgrade

Host: localhost:7070


Sec-WebSocket-Protocol: xmpp

Pragma: no-cache

Cache-Control: no-cache

Sec-WebSocket-Key: 7ojGbXP+Jo2Wa46bRGtoOA==

Sec-WebSocket-Version: 13

Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits, x-webkit-deflate-frame

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36


HTTP/1.1 302 Found

Location: http://localhost:7070/ws/

Content-Length: 0

Server: Jetty(7.x.y-SNAPSHOT)



Im assuming you are using the latest Strophe.js. you can take a look at this post Anyone Got Strophe.js to Work with WebSocket Plugin?

I had the same issue.

Hi Ed,

This is a better late than never post.

I have it working on my laptop with OpenFire v3.9.3 and the old file from I use my own version of strophe.js for websockets, which I am still working on. It seems to work pretty good, but it hasn’t been rigorously tested. Anyway, here is where you can find the code:

,and the websocket version is v102ws.uc.js file.

The rest of the strophe.js related files are there too. I am using Strophe.js with Candy Chat, and those files for reference are as follows:

Simple demo page and configuration: ttps://

Actual Candy Chat (my version): ttps://

I spent a fair amount of time piecing together the best of what I could find at the time for websockets and OpenFire (about a year ago). If nothing else, it should be a good starting point or ref. for the next iteration, if there is going to be one.

the web socket URL should be ws://