Javascript chat inside your Drupal
JavaScript PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Brings all XMPP wonders to Drupal, interacting with user via javascript and plain old HTTP.
Strophe javascript library is used for handling all javascript gears :

XMPP server with http-binding is the same domain as the drupal web site.
Developpement is done with Ejabberd and its modules
 * mod_muc
 * mod_http_bind

With the Drupal's module ejabberd_auth, drupal can provides users to ejabberd :


You have to choose a domain for your xmpp server, it may be a real domain, if you wont to use classical xmpp client, or a fake one if you only wont to use it inside Drupal.


Install and configure an Ejabberd with drupal authentification

Set your domain. Here, I use a fake domain : tchat.tld


%% Hostname
{hosts, ["localhost", "tchat.tld"]}.


Configure http_bind

{5280, ejabberd_http, [


And load the module in the right place, in the modules block, near the end of the config file. Be careful with the ending comma.


{mod_http_bind,  []},


Restart ejabberd. If you try to connect with a web browser to http://myserver:5280/http-bind you should see :

Ejabberd mod_http_bind v1.2

An implementation of XMPP over BOSH (XEP-0206)

http bind may not work with packaged version, use the source to compile a fresh ejabberd.

Web server

Use proxy on your web server (apache, lighttpd ...) to provide /http-bind in the same adress as your website. Be careful with open proxy.
Here is an apache 2 configuration example :


ProxyVia on
ProxyRequests off
ProxyPreserveHost on
<Proxy *>
	Order deny,allow
	Allow from all

ProxyPass /http-bind
ProxyPassReverse /http-bind


Restart Apache. You should see the debug page on http://myserver/http-bind

Here is a lighttpd configuration example :

$HTTP["url"] =~ "^/http-bind" {
                proxy.server = ("" => (
                        ("host" => "", "port" => 5280)



Go to /admin/settings/strophe to set your domain

Puts chat block where you wont on your website.

In your theme, you should have something like :

#tchat {
	overflow: auto;
	height: 100px;
	border: thin solid black ;


For now, you have to use clean url.

-- USAGE --
Strophe use sub modules: muc and chat. Muc is for Multi User Chatroom, and chat is a one to one discussion. With Ejabberd external auth, you don't have any user, so, every rosters are empty. For handling user presence, a simple chatroom is used, every user join this room, and you can display it or just use it for connection status.

The MUC module provides two blocks, one for the presence list, the other for the chatroom.
If you wont, presence list can be used as a starting point for a private discussion.

The Chat module provide one page, for a one to one discussion. The easiest way is to use presence list to trigger a discussion.

Strophe module is not a gtalk clone, it's a framework with usable features. You can use the power of xmpp and javascript with it. Event or query can be send throw XMPP. I click somewhere on my browser, something will happening on my correspondent's browser. I can ask query, and handling answer too.

The Strophe Javascript framework was build to handle chess party.

Psi is ugly xmpp client, but its XML console is priceless.

-- BUG --

Strange bug with direct chat on ejabberd 2.1.6, but it works well on 2.1.5. Weirds.

-- LATER --
 * Pubsub
 * Chat as a popup, everywhere.

Mathieu -