…ActionCable Troubleshooting: Turbolinks

The Problem

Within a Rails app, ActionCable (and therefore WebSockets) did not work when trying to update all users of a new comment.

Expected behaviour was for a user to publish a comment and then a hidden div would be made visible, alerting users that there was a new comment.

How Did I Fix This?

tl;dr: ActionCable requires Turbolinks to work.

I had disabled Turbolinks on my app to enable a Javascript plugin. Little did I know, at that time, that I would be using ActionCable later on. In essence, my decision was between ActionCable functionality or that Javascript plugin.

Brave developer, spare yourself some time and just re-enable Turbolinks. Learn from my stupidity.