Ask A Question


You’re not receiving notifications from this thread.

Reopen ActionCable after login?

Marcus S asked in Rails

Hey Folks,

I'm currently using Jumpstart and Stimulus Reflex.

After logging in, I am getting an error in the Browser's JS console:

The ActionCable connection is not open! `this.isActionCableConnectionOpen()` must return true before calling `this.stimulate()`

If I refresh the page (after being logged in), the websocket opens and all is good.

Is there a way I can reopen the ActionCable websocket after logging in?




Jumpstart modifies form submits to be AJAX requests using turbolinks_render.

Your default Rails form submission is a POST request, so the page would fully reload and ActionCable would connect.

I never thought about it, but that is probably something that can/should be triggered after login. A Stimulus controller for this would make sense. It can just check fi the connection is open and, if not, issue the connect. It would probably need to be on every page, unless there's a way to do it after login. I need to think on a good way to do that.


So, just tested this as I added multitenancy to ActionCable in Jumpstart Pro. I confirmed that ActionCable will attempt to connect automatically after you login because of the NotificationsChannel we added.


You can also call anytime to connect.


Fantastic, thanks for the tip Chris!



Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,969+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.