cuongth / ejabberd-websockets

An ejabberd component to handle XMPP over Websockets

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 will be an implementation of the XMPP Over Websocket Draft proposed by Jack Moffitt and Eric Cestari. The Websocket implementation is based on this The WebSocket Protocol.

**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 : connection = new Strophe.Connection("ws://:5288/ws-xmpp", {protocol: "ws"});

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.

About

An ejabberd component to handle XMPP over Websockets

License:GNU General Public License v2.0


Languages

Language:JavaScript 75.2%Language:Erlang 24.8%Language:Shell 0.0%