mclintprojects / actioncable-vue

A Vue plugin that makes integrating Rails Action Cable dead-easy.
MIT License
181 stars 38 forks source link

A callback for when the global connection is dis/established #15

Closed brendon closed 4 years ago

brendon commented 4 years ago

Is your feature request related to a problem? Please describe. I'd like to indicate to the user when the WebSocket connection goes down (and also prevent some actions).

Describe the solution you'd like I'd imagine being able to specify the callbacks (connect and disconnect) in the configuration object?

Describe alternatives you've considered There doesn't seem to be any other way to detect the initial connection that I can see :)

brendon commented 4 years ago

Looking closer, I don't think action_cable provides any transparency into the overall connection, only to individual subscription connections. A bit of a shame, but nevermind.

I suppose one could use a kind of dummy global subscription and use the callbacks in that.

mclintprojects commented 4 years ago

Yes. It's why I went with Node.js & socket.io for a Websocket implementation where I needed to be aware of client or server disconnection.