Skip to content


Subversion checkout URL

You can clone with
Download ZIP
WAMP in JavaScript for Browsers and NodeJS
JavaScript Python Other

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
when @ 00fdea1


  • Asynchronous RPC/PubSub over WebSocket
  • WAMP compatible implementation (see
  • no dependencies
  • tiny size (47kB, 13kB minified, 5kB compressed)
  • MIT License

What is that?

WebSockets is already built into modern browsers and provides full-duplex, low-latency communication.

However, as such, it is quite low-level. Web apps often have a need for higher level messaging patterns:

  • Publish & Subscribe
  • Remote Procedure Calls

This is where WAMP enters. WAMP (The WebSocket Application Messaging Protocol) runs on top of raw WebSocket and provides PubSub and RPC.

Technically, WAMP is a proper WebSocket subprotocol that uses JSON as message serialization format. WAMP was designed to be easy to use and simple to implement.

AutobahnJS implements WAMP in JavaScript to be used in browser based applications.

Read more about WAMP and other WAMP compatible implementations on

Show me the code!

This is how you do publish & subscribe with AutobahnJS.

Include AutobahnJS

  <script src=""></script>

.. connect and subscribe to receive events on a topic

  var sess;

  window.onload = function() {
     sess = new ab.Session("ws://localhost:9000", function() {

        sess.subscribe("", onEvent1);

  function onEvent1(topic, event) {
     alert("got event: " + event);

.. and publish an event to a topic

  function publishEvent1() {

     sess.publish("", {a: 23, b: "foobar"});


  <button onclick="publishEvent1();">Publish!</button>

You can find a complete app template including proper error handling here


More Information

For more information, including tutorials and reference, please visit:


Get in touch on IRC #autobahn on or join the mailing list on

Something went wrong with that request. Please try again.