title: Autobahn.js - subscribe doesn't work with websockets
body: <p>I'm using Ratchet WebSockets and Autobahn.js for two-way client-server communication. I've installed everything, opened the ports, it's been weeks (yes, literally weeks) and it still doesn't work. I think I've narrowed it down to Autobahn's subscribe method not working correctly.</p>
  
  <p>What I'm using is a slight modification of the example code found here:</p>
  
  <p><a href="http://socketo.me/docs/push" rel="nofollow">http://socketo.me/docs/push</a></p>
  
  <p>Here is my client code:</p>
  
  <pre><code>&lt;script&gt;
      window.define = function(factory) {
          try{ delete window.define; } catch(e){ window.define = void 0; } // IE
          window.when = factory();
      };
      window.define.amd = {};
  &lt;/script&gt;
  &lt;script src="/apps/scripts/when.js"&gt;&lt;/script&gt; 
  &lt;script src="http://autobahn.s3.amazonaws.com/js/autobahn.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      var conn = new ab.Session(
          'ws://light-speed-games.com:8080' // The host (our Ratchet WebSocket server) to connect to
        , function() {            // Once the connection has been established
              console.log('Connection established.');
              conn.subscribe('kittensCategory', function(topic, data) {
                  // This is where you would add the new article to the DOM (beyond the scope of this tutorial)
                  console.log('New article published to category "' + topic + '" : ' + data.title);
              });
          }
        , function() {            // When the connection is closed
              console.warn('WebSocket connection closed');
          }
        , {                       // Additional parameters, we're ignoring the WAMP sub-protocol for older browsers
              'skipSubprotocolCheck': true
          }
      );
  &lt;/script&gt;
  </code></pre>
  
  <p>I believe the problem lies here:</p>
  
  <pre><code>function() {            // Once the connection has been established
                  console.log('Connection established.');
                  conn.subscribe('kittensCategory', function(topic, data) {
                      // This is where you would add the new article to the DOM (beyond the scope of this tutorial)
                      console.log('New article published to category "' + topic + '" : ' + data.title);
                  });
              }
  </code></pre>
  
  <p>The line <code>console.log('Connection established.');</code> does its job - it logs its message in the console. However, the <code>conn.subscribe</code> method does nothing. It doesn't matter if I change <code>kittensCategory</code> to any other string, it still does nothing. But <code>kittensCategory</code> is the only thing that makes sense here (see Ratchet's example code through the link above).</p>
  
  <p>Any ideas?</p>
  
  <p>EDIT:</p>
  
  <p>This is the output of ab.debug:</p>
  
  <pre><code>WAMP Connect autobahn.min.js:69
  ws://light-speed-games.com:8080 autobahn.min.js:69
  wamp autobahn.min.js:69
  WS Receive autobahn.min.js:64
  ws://light-speed-games.com:8080  [null] autobahn.min.js:64
  1 autobahn.min.js:64
  [0,"52cbe9d97fda2",1,"Ratchet\/0.3"] autobahn.min.js:64
  WAMP Welcome autobahn.min.js:67
  ws://light-speed-games.com:8080  [52cbe9d97fda2] autobahn.min.js:67
  1 autobahn.min.js:67
  Ratchet/0.3 autobahn.min.js:67
  Connection established. client.php:15
  WAMP Subscribe autobahn.min.js:74
  ws://light-speed-games.com:8080  [52cbe9d97fda2] autobahn.min.js:74
  kittensCategory autobahn.min.js:74
  function (topic, data) {
                  // This is where you would add the new article to the DOM (beyond the scope of this tutorial)
                  console.log('New article published to category "' + topic + '" : ' + data.title);
              } autobahn.min.js:74
  WS Send autobahn.min.js:72
  ws://light-speed-games.com:8080  [52cbe9d97fda2] autobahn.min.js:72
  1 autobahn.min.js:72
  [5,"kittensCategory"] 
  </code></pre>