Subscribing, Sending and Receiving ActionCable messages with vanilla JavaScript
ActionCable is an awesome feature of Rails that allows for sending real-time messages. If your frontend is part of your Rails app, much of the plumbing is handled for you. However, sometimes you need to use ActionCable, outside of Rails. In this blog post I’ll show you how to subscribe to a channel, print out messages and publish messages, all with vanilla JavaScript. Although I’m using JS, the principles apply to any language that supports websockets.