Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

Z-XMPP

For more info, visit http://ivan.vucica.net/zxmpp/.

What is it?

This is an implementation of an XMPP client in JavaScript. It uses BOSH concept of HTTP binding as defined by XEP-0124 and XEP-0206.

It is a semi-structured hack, assembled not so much as a planned effort by a JavaScript expert; it's more of a thing that's here just to serve its purpose, and that purpose is luckily for its internals to be pretty. So hacker: beware!

Goal

Goal is to have a backend library for doing XMPP, and a separate GUI that will allow attaching an overlay over existing webpage, as well as almost transparent reconnection upon unloading the page and reloading it.

Another goal is to support major standards-based browsers: Safari, Chrome, Opera, Firefox.

User interface

While primarily an XMPP library that preserves connection between page switches, Z-XMPP also includes an ugly user interface component for instant messaging. It appears as a bar on the bottom of the screen.

Screenshot of Z-XMPP UI

Compatibility

It is expected that the client will cover at least XEP-0242: XMPP Client Compliance 2009 Core Client profile. Of course, almost anything goes that doesn't require additional socket connections (since they're a bit... tricky to do in JavaScript, you'll surely agree).

Z-XMPP has been tested with the following BOSH connection managers:

Z-XMPP has been tested with the following XMPP server software:

Version 1.0

Following SASL authentication methods are partially or fully supported:

  • PLAIN
  • DIGEST-MD5

Following XEPs are partially or fully supported:

  • XEP-0030: Service Discovery
  • XEP-0054: vcard-temp
  • XEP-0085: Chat State Notifications
  • XEP-0092: Software Version
  • XEP-0115: Entity Capabilities
  • XEP-0124: Bidirectional-streams Over Synchronous HTTP (BOSH)
  • XEP-0206: XMPP Over BOSH

There may be additional features supported, but not documented.

License

Please read the LICENSE to see current use terms.

Installation

Here's how to set up demo.php to work.

  1. Start up a server such as ejabberd or Prosody. Enable BOSH in it by referring to the server's manual. Alternatively, set up a connection manager for BOSH (a BOSH service that acts as a proxy to the real XMPP server). A good connection manager is Punjab.
  2. Get your HTTP server to forward requests from a directory in the same domain and port that your site (or demo.php) is hosted on. If you use Apache, .htaccess shipping with Z-XMPP is a good starting point. This is required due to Javascript cross-domain scripting access policies on modern browsers, which would prevent Z-XMPP and any other Javascript XMPP library from accessing the actual BOSH server directly.
  3. Edit demo.php to point to the directory that now redirects to the proper path and port of your BOSH server.

These instructions can, of course, be improved, and the author will be happy to answer your questions on how to get Z-XMPP to connect to your XMPP server on your web site (to the extent of his ability, of course).

Contributing

Patches and good natured criticism can be directed to zxmpp@vucica.net.

You can also contact me via xmpp:ivucica@gmail.com


Copyright 2010-2012 Ivan Vučica

Recent activity

Ivan Vučica

Ivan Vučica pushed 4 commits to ivucica/ZXMPP

eb8040b - Merge
e0d9ecc - Logging every incoming and outgoing packet. Prefixed with << and >> for easier filtering in zxmppConsole.
70c6eed - Redirecting warnings from stanzastreamfeatures to zxmppConsole instead of console.
37a0ee2 - <session/>'s 'to' could contain colon and port. Fixed.
Ivan Vučica

Commits by Ivan Vučica were pushed to ivucica/ZXMPP

25bc818 - Crashfixes. In presence, show and type are not the same. When doing presenceUpdate, also pass the original stanza to handlers (needed to handle subscriptions).
Ivan Vučica

Commits by Ivan Vučica were pushed to ivucica/ZXMPP

408d4e4 - Server may return fullJid with different bareJid. This is particularly true with auth mechanism ANONYMOUS. So, update local bareJid too.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.