Commit Graph

30 Commits

Author SHA1 Message Date
Duncan Grazier
23e3e2bc2b ActionCable should not raise when a connection is already open
ActionCable was throwing a "Existing connection must be closed before
opening" exception which was being picked up as a production issue in
our error monitoring software. Since this happens pretty often on any
device that allows the browser to sleep (mobile) this error was getting
triggered often.

This change removes the exception, but keeps logging the occurrence. We
now return `false` to let the caller now that `open` failed.
2017-01-06 12:49:58 -05:00
Jon Moss
66901c1849 Add configuration for WebSocket and logger
[Javan Makhmali, Jon Moss]
2016-05-31 13:06:08 -04:00
Javan Makhmali
11078dddbb Build action_cable.js with Blade 2016-05-24 13:11:10 -04:00
Jon Moss
548c1d6e8b
Publish Action Cable to NPM when we release.
Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
2016-05-11 19:36:27 -07:00
Jeremy Daer
9c2945f4cc Cable typo: isSupportedProtocol -> isProtocolSupported 2016-04-05 21:56:59 -07:00
Jeremy Daer
fa3537506a Merge pull request #24224 from danielrhodes/actioncable-websocket-protocols
ActionCable protocol negotiation
2016-04-05 09:26:11 -07:00
Daniel Rhodes
cbd15da027 Added protocol negotiation
This is primarily for backwards compatibility for when
or if the protocol is changed in future versions.

If the server fails to respond with an acceptable
protocol, the client disconnects and disables
the monitor.
2016-04-05 15:55:59 +02:00
Jon Evans
ff5f1d33fc Fix WebSocket already open log message typo 2016-03-22 12:55:37 -06:00
Javan Makhmali
1d5f80c758 Return subscription object(s) when updating the collection 2016-03-04 10:34:24 -05:00
Pratik Naik
9ce6fe439a Make sure ActionCable.Subscriptions#create always returns the newly created subscription object 2016-03-04 09:30:15 -06:00
Javan Makhmali
3e4ecbe8e6 Store reference to Subscriptions instance for convenience 2016-03-03 21:44:11 -05:00
Javan Makhmali
f1c93ed828 Implicity add Subscription instance to subscriptions collection 2016-03-03 21:40:16 -05:00
Javan Makhmali
6689d7c7b9 Share default mount path with client side .js 2016-03-03 21:27:52 -05:00
Javan Makhmali
5e84b95578 Fix location of default mount path value
#getConfig was implmented as general utility for reading action-cable-* meta tags (hence the `name` argument). Introduced in 8b69f1eeba753c38364fb88136b2503480f2de1d.
2016-03-03 21:10:10 -05:00
Javan Makhmali
96e6de9552 Defer starting connection monitor until a connection is opened 2016-03-03 20:23:20 -05:00
Javan Makhmali
82a1bf268d Establish WebSocket connection when first subscription is created. Fixes #24026
* More intention revealing than connecting on the first call to Connection#send
* Fixes that calls to Connection#send would attempt to open a connection when the WebSocket's state is CONNECTING
2016-03-03 17:59:12 -05:00
Daniel Rhodes
78b0ac3259 ConnectionMonitor is once again notified of disconnect 2016-03-03 15:00:11 +01:00
Daniel Rhodes
53e163dc3f Make ping into a message type
This change makes ping into a message type, which
makes the whole protocol a lot more consistent.

Also fixes hacks on the client side to make this all
work.
2016-03-01 02:48:15 +01:00
Daniel Rhodes
f51cb7eef5 Added welcome message type and fix test hacks 2016-03-01 01:38:35 +01:00
Jon Moss
1afd414488 Only open Action Cable connection if data is being sent 2016-02-24 20:37:52 -05:00
Jon Moss
8b69f1eeba Enable Action Cable routes by default
This also marks Action Cable routes as internal to Rails.
2016-02-24 19:05:03 -05:00
Javan Makhmali
c889408e0d Fix isAlive condition and add more logging 2016-02-23 09:37:50 -06:00
Javan Makhmali
dde833816a ActionCable.log 2016-02-23 09:37:50 -06:00
Javan Makhmali
1a90ff9a4d Uninstall event handlers when replacing WebSocket instance
Ensures we don't get "onclose" events from a previous WebSocket that was in the "closing" state
2016-02-23 09:37:49 -06:00
Javan Makhmali
ab28276713 Connection#isAlive 2016-02-23 09:37:49 -06:00
Pratik Naik
96118db335 Log ConnectionMonitor connect 2016-02-23 09:37:49 -06:00
Pratik Naik
725c913c90 Treat 'closing' state as closed.
We are seeing cases where the websockets get stuck in the 'closing' state
after a tab has been in background for a while. So lets treat those websockets
as closed.
2016-02-23 09:37:49 -06:00
Javan Makhmali
832f88bdf3 Add client-side console logging to help debug reconnect issues 2016-02-23 09:37:49 -06:00
Matthew Draper
d6f2000a67 Wrangle the asset build into something that sounds more general 2016-02-01 05:03:03 +10:30
Jon Moss
09a7060659 Improvements and reorganization of assets 2016-01-30 20:44:42 -05:00