New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ActionCable: FE Disconnection Reason #46952
Comments
Hey @DosCervezas, could you upload a repo to demonstrate the issue? This makes it so much easier to take a look into the issue, thank you! |
thanks for your reply hahmed but I rerolled my own branch days ago sorry the reason is logged in line 138 but not passed further. Thats my problem.. and globaly overwritting the log function to get the reason is not the right way I guess... |
I'm not sure that's the way to go, I mean you can use the logger for logging too, but maybe you want something like this https://guides.rubyonrails.org/action_cable_overview.html#server-side-components-channels-exception-handling Handle the exception then broadcast the error message to another channel that displays errors in a modal/alert/banner or something? (been a while since I used action cable, so I would need to test it) |
I did a quick test and managed to broadcast an error message to another channel, something along the lines of I'm closing this because I don't think this is an issue. |
Sorry for breaking your issue pattern but I thought it would be a bit of overkill for my simple issue.
Expected behavior
I would like to specify a specific disconnect reasons, that the FE could catch and react on it.
Therefore I defined Standard error handled it in the handle_open method
It works like a charm, the message is broadcasted to the FE
But I cannot catch the reason.. after debugging I found the culprit
The reason is not passed to the close of the websocket
Actual behavior
I would like to catch the reason, why the connection is disconnected. Of course I could do it on the serverside but the reason seems to me a valid other approach.
System configuration
Rails version:
Rails 7.0.4
"@rails/actioncable": "^7.0.4"
Ruby version:
ruby 3.1.2p20
The text was updated successfully, but these errors were encountered: