Anyone Got Strophe.js to Work with WebSocket Plugin?


I wonder if anyone ever got Strophe.js to work with the WebSocket plugin on OpenFire? I tried to connect to my OpenFire server using Strophe.js with below code. I am using the last version of Strophe.js (version 1.1.3), and latest version of the plugin (version I tried to debug Strophe. When it opens, it sent a message “<stream:stream to=‘’ xmlns=‘jabber:client’ xmlns:stream=‘’ version=‘1.0’>” to Openfire. However, on the Openfire side, it is complaining “org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 125; XML document structures must start and end within the same entity.”.

function connectHandler(cond) {

if(cond == Strophe.Status.CONNECTED) {


} else {

alert("status: " + cond);



var username = “****”;

var password = “****”;

var url = “ws://foo:7070/ws/server?username=” + username + “&password=” + password + “&resource=xmpp”;

var connection = new Strophe.Connection(url);

connection.connect(username, password, connectHandler);

The above code was run from http://foo:7070/ws/peek/test/, so cross domain is not an issue.

websoocket plugin uses a non-standard method which was developed before the xmpp standard now used in strophe 1.1.3 was developed.

Thanks. That make sense. Any other way to let openfire work with strophe on websocket? Another plugin for openfire?

I know I can use the ofclient code that comes with the websocket, but I would like to use strophe if i can.

strophe-openfire.js is a strophe implementation of an xmpp client for openfire websockets. You can find it in the candy web client or ofmeet. I use Openfire.Connection as a direct replacement of Strophe.Connection

Note that since this thread was answered, the websocket plugin was improved. It now adheres to the standard specification. In other words, you can make Strophe (or any other websocket-implementation for that matter) connect to Openfire via websockets just fine.

Sounds good, but running with:

  • Openfire 4.0.2

  • Openfire WebSocket 1.1.3

  • Openfire Meetings 0.3.9

Still produces: WebSocket connection to ‘wss://XXXX:7443/ofmeetws/server?username=XXX&password=null&resource=ofmeet4’ failed: Error during WebSocket handshake: Unexpected response code: 503

Or are the updates not released yet?

strophe.js last version you can use like this
var conn = new Strophe.Connection(“ws://host:7070/ws/server”, {protocol: “ws”});

Michael, you’re trying to connect to the websocket implementation that is in OFMeet. I’d suggest you use the plugin cleverly named “Openfire Websocket” instead. Then, the path that you use should be equal to that of HTTP-BIND ( :7443/http-bind/ by default). There’s an effort underway to remove the OFMeet-specific websocket implementation from the OFMeet plugin, and use the Websockets plugin instead - so sooner or later, you probably need to switch anyway.

Thank you both very much.

so i´ll look forward to the cleanup of the packages and all are happy

I switched the config.js like this:

bosh: window.location.protocol + “//” + + ‘/http-bind/’ // FIXME: use xep-0156 for that

and this did the trick until now.

kind regards