Reopen ActionCable after login?
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.