title: How to use ActionCable as API
body: <p>I built a very simple app using Rails 5 beta 1 and ActionCable to show when users come online and let them send messages to each other. </p>
  
  <p>Now, I would basically like to take the client-side part of ActionCable, implement it in the context of another app (that does <strong>not</strong> run on Rails 5) and connect it with the first app to send and receive data (such as the online status of users or messages).</p>
  
  <p>To send data from that second app, I assume, I can simply make an AJAX POST request. The question is: <strong>How do I subscribe from my second app to an open connection of the first app?</strong></p>
  
  <p>Or even: How do I subscribe to the ActionCable connection of my Rails app from another app via API?</p>
  
  <p>My guess is, I essentially want to include this coffeescript somehow in my second app:</p>
  
  <pre><code>App.appearance = App.cable.subscriptions.create "AppearanceChannel",
    connected: -&gt;
      # Called when the subscription is ready for use on the server
  
    disconnected: -&gt;
      # Called when the subscription has been terminated by the server
  
    received: (data) -&gt;
      # ...
  </code></pre>