A simple BOSH middleware

npm install bosh
28 downloads in the last month


This is a simple BOSH middleware (for anything with a connect-like API), or can be used as a connection handler function for the raw node HTTP server.


var http = require('http');
var bosh = require('./bosh.js');

Example as Connect middleware

var connect = require('connect');
var urlrouter = require('urlrouter');

var app = connect();

var bosh = require('./bosh.js');

var router = urlrouter(function(app) {
    var boshHandler = bosh();'/http-bind/', boshHandler);
    app.get('/http-bind/', boshHandler);

app.use(connect.logger({ immediate: true, format: 'dev' }));




It implements just enough of the connection manager protocol at this point to pass through an XMPP session. Correctness is left for a later pass through the code. There is little to no error handling.

There's still a glitch with libpurple clients dropping connections and replacing them.

No multiple stream support yet.

No repeatable reads yet.

npm loves you