Skip to content

superfeedr/ejabberd-websockets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repo is not maintained and most of the code in here is probably deprecated.

Websocket Module for Ejabberd

This is a module that adds websocket support for the ejabberd XMPP server. It's a more elegant, modern and faster replacement to Bosh.

It is an implementation of the XMPP Over Websocket Draft proposed by Jack Moffitt and Eric Cstari. The Websocket implementation is based on this draft specification.

**You need to use the apt version of ejabberd, as the binary install comes with an old version of erlang. **

Install

Build

./build.sh

Install

cp ebin/*.beam /path/to/ejabberd/lib/ebin/

Configure

In the listeners section add the following line:

{5288, ejabberd_websocket, [{request_handlers, [{["ws-xmpp"], mod_websocket}]}]},

Make sure you also add this line in the Modules

{mod_websocket, []}

Usage

Just connect to the websocket using your browser's API, and send your XMPP traffic over it.

You may find it convenient to use directly Strophejs as it's a full XMPP library in Javascript. However, you will have to use this branch for now, as it adds support for websocket, as the underlying protocol (instead of Bosh).

To setup a connection : // WS_SERVICE should be http://host.tld:5288/ws-xmpp, based on the configuration you chose. connection = new Strophe.Connection({protocol: new Strophe.Websocket(WS_SERVICE) });

TODO

The most 'urgent' thing to do is to provide fallback mechanisms in this module. For example, support for socket.io would be amazing, as erlang has its own implementation. Feel free to fork and make it better!

Thank you

Sponsored by Superfeedr. Special thanks to Nathan for his awesome work, Jack for his help.

License

See License.markdown.