This controller can be put on body or any other element.
- Adds a websocket accessor to the element
- Controller exposes a
connected
boolean getter - Controller bails with a warning if no shared consumer is available
- Element will have
data-action-cable-connected
ordata-action-cable-disconnected
attributes which can be used for CSS selectors - Element will emit
action-cable:connected
oraction-cable:disconnected
events only when state is flipping - Errors => Disconnected to keep things simple
I intend to document the navigator.onLine
accessor and the window:online/offline
events so devs can handle PWA modes.
Seeking feedback on the following:
- is it within the realm of acceptable to ask people to import
consumer
and assign it toapplication.consumer
? - is it obnoxious for me to call this controller
websocket
? - do you like the event handles and attribute names?