Hi everyone,

Recently I was trying to show an alert if the ActionCable connection became 
closed. I poked around the code and learned that there wasn't a great way 
to hook into the events.

I ended up polling the connection status with:

```
setInterval( () => { if (App.cable.connection.getStatus() === "closed") { 
callSideEffectCode() } }, 5000)
```

But I'd rather have been able to just write something like:

```
App.cable.customHandler["closed"] = callSideEffectCode
```

Would people be interested in a feature that adds support for custom 
callbacks for the 4 types of WebSocket events that ActionCable.Connection 
handles? I think it'd be a very small PR.

thanks,
Dan

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to