Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/superfeedr/ejabberd-websockets

An ejabberd component to handle XMPP over Websockets
https://github.com/superfeedr/ejabberd-websockets

Last synced: 3 months ago
JSON representation

An ejabberd component to handle XMPP over Websockets

Awesome Lists containing this project

README

        

> 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](http://www.ejabberd.im/) XMPP server. It's a more elegant, modern and faster replacement to Bosh.

It is an implementation of the [XMPP Over Websocket Draft](http://tools.ietf.org/html/draft-moffitt-xmpp-over-websocket-00) proposed by Jack Moffitt and Eric Cstari. The Websocket implementation is based on this [draft specification](http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-03).

**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](https://github.com/metajack/strophejs) as it's a full XMPP library in Javascript. However, you will have to use [this branch](https://github.com/superfeedr/strophejs) 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](http://socket.io/) would be amazing, as erlang has its own [implementation](https://github.com/yrashk/socket.io-erlang). Feel free to fork and make it better!

## Thank you

Sponsored by [Superfeedr](http://superfeedr.com). Special thanks to [Nathan](http://unclenaynay.com/) for his awesome work, [Jack](http://metajack.im/) for his help.

## License

See [License.markdown](./ejabberd-websockets/blob/master/License.markdown).