I\'m playing around with the new ActionCable feature. Is there a way of communicating with the ActionCable server using say socket.io or from an application using React or R
You can interact with ActionCable as you would normally with any WebSocket libraries.
To do so, you would stream from a Channel in Rails:
class ExampleChannel < ApplicationCable::Channel
def subscribe
stream_from 'example'
end
end
Then, you may connect to the Rails WebSocket through your stand-alone client and subscribe to the message using the ActionCable protocol:
function Socket(url) {
const ws = new WebSocket(url);
ws.onopen(() => {
ws.send('{"command":"subscribe","identifier":"{\"channel\":\"ExampleChannel\"}"');
});
}
Reference: http://edgeguides.rubyonrails.org/action_cable_overview.html#channels
https://github.com/NullVoxPopuli/action_cable_client/blob/master/README.md