Commit Graph

51 Commits

Author SHA1 Message Date
Pratik Naik 84b1f0a3e6 Send subscription confirmation from server to the client to avoid race conditions.
Without this, it's very easy to send messages over a subscription even before the
redis pubsub has been fully initialized.

Now we delay calling the subscription#connected method on the client side until we
receive a subscription confirmation message from the server.
2015-10-16 21:11:21 -05:00
Javan Makhmali c0e554c943 Tweak reconnect timing 2015-10-14 18:07:08 -05:00
Javan Makhmali 889d8ae3d7 Remove immediate reconnect to help avoid thundering herd after server restarts 2015-10-14 18:06:23 -05:00
Javan Makhmali 7ec1290f27 Avoid returning results of loop 2015-10-14 17:09:32 -05:00
Javan Makhmali e8e6937d96 Add delay before reopening 2015-10-14 17:09:10 -05:00
Javan Makhmali e07972711e Improve guard against opening multiple web sockets 2015-10-14 17:06:21 -05:00
Rafael Mendonça França eb8c713c98 .js.coffee -> .coffee
It was initially required, but support for the shorthand has been
 supported since sprockets 2.1. Eventually 4.x will only support the
 shorthand version. Just want to get new people using the prefer stuff
 ASAP.
2015-09-02 02:57:38 -03:00
Javan Makhmali 60adbaf4af Increment style 2015-08-31 08:14:17 -05:00
Javan Makhmali 9e0c0afe1c Guard against opening multiple connections 2015-08-31 07:54:54 -05:00
Javan Makhmali f4b5a4ecdf Immediately reconnect after first disconnect 2015-08-28 18:05:46 -04:00
Javan Makhmali ddfd649c11 Only send "disconnected" notification once 2015-08-28 17:52:46 -04:00
Javan Makhmali 1379e973be Simplify WebSocket reconnects and guard against opening multiple connections 2015-08-28 17:45:07 -04:00
Javan Makhmali 5ee5e419be Record last 20 Subscription notifications for inspection 2015-08-23 17:58:06 -04:00
Javan Makhmali fa362c724d Immediately reconnect when visibilityState changes to "visible" 2015-08-23 17:57:09 -04:00
Javan Makhmali dc4f8b352c Don't unsubscribe on the server when another subscription with the same identifier is active 2015-07-23 17:20:04 -04:00
Lachlan Sylvester 79b05aece1 update documentation to use websocket protocol 2015-07-09 17:21:11 +10:00
David Heinemeier Hansson c708928276 Document the JavaScript classes 2015-07-08 14:42:04 +02:00
David Heinemeier Hansson fdd5c925f5 Move the subscription factory method from the consumer to the subscriptions collection 2015-07-08 11:06:07 +02:00
David Heinemeier Hansson 7c6a7f28eb Rename SubscriptionManager/Subscriber -> Subscriptions
This matches the server-side setup and is more consistent.
2015-07-08 11:00:24 +02:00
Javan Makhmali 026fd5b946 Add URL to inspector 2015-07-07 09:51:40 -04:00
Javan Makhmali 239d79e9eb Add helper to inspect current state 2015-07-07 09:43:22 -04:00
Javan Makhmali ee6b6cabfb Rework event handlers 2015-07-07 08:57:57 -04:00
Javan Makhmali 5da432c45b websocket -> webSocket 2015-07-06 21:43:50 -04:00
Javan Makhmali f2542cd417 Guard against opening multiple WebSocket connections 2015-07-06 21:42:49 -04:00
Javan Makhmali 336d12f97a Rework connection monitor 2015-06-27 16:17:06 -04:00
Javan Makhmali d2c613cd8f Wait for connection to close before reopening it 2015-06-27 16:17:06 -04:00
Javan Makhmali 5541b8fcaf Update connection API with #open, #close, #reopen 2015-06-26 10:24:29 -04:00
Javan Makhmali 315c0fbf19 Fix misspelled variable 2015-06-25 18:46:33 -04:00
Javan Makhmali 84ed139700 Cable.Consumer 2015-06-25 16:24:58 -04:00
Javan Makhmali fa0281aeb1 Cable.Channel -> Cable.Subscription 2015-06-25 16:12:26 -04:00
Javan Makhmali 0e5c9e741a Manage an array of subscribers since there may be more than one subscription to a channel 2015-06-25 16:08:44 -04:00
Javan Makhmali 3509a1226c event -> callbackName 2015-06-25 15:22:39 -04:00
Javan Makhmali 288d289b72 Add "initialized" notification 2015-06-25 14:07:14 -04:00
Javan Makhmali c846f43d46 Extract connection monitoring and rewrite as a subscriber 2015-06-25 13:57:40 -04:00
Javan Makhmali d9d7371c56 Assume subscribers have an identifier 2015-06-25 11:36:40 -04:00
Javan Makhmali 53d0b22aee Switch back to original API and callback naming 2015-06-25 10:32:36 -04:00
Javan Makhmali c7f00661bf Move connection and subscriber code into their own classes 2015-06-25 10:21:53 -04:00
Javan Makhmali 0f761c0d51 Update API to camel cased equivalent of WebSocket's API 2015-06-24 18:22:16 -04:00
Javan Makhmali 268ee5208c Create JavaScript channels identified by their Ruby class name 2015-06-24 14:26:26 -04:00
Javan Makhmali b5e0e58fe1 Require Cable.Channel constructors to define their channel name
Function.name is not widely supported, and a function's name can be mangled by a minifier making it an unreliable property to infer the channel name from
2015-06-23 18:16:31 -04:00
David Heinemeier Hansson f6daf0ef6d Assume channel names include the _channel extension 2015-06-20 16:34:27 +02:00
David Heinemeier Hansson 0e4c2df1e1 Add new convention method for performing channel actions 2015-06-20 16:01:44 +02:00
David Heinemeier Hansson 2258344e0f Switch internal actions to be called commands instead, such that we can use action as the routing word on the user side 2015-06-19 19:05:06 +02:00
Pratik Naik bdbbe18f3c Clear ping wait timeout when removing the connection 2015-04-03 09:32:22 -05:00
Pratik Naik 63d61051aa Increase the stale timout 2015-03-24 10:24:43 -05:00
Pratik Naik 9264ceb437 Don't call connection#close directly 2015-03-23 15:31:53 -05:00
Pratik Naik 6451fe1408 Call reconnect() when a ping doesnt arrive in expected time 2015-02-26 16:33:41 -06:00
Pratik Naik 89f3fb71c7 Remove existing connection when trying to reconnect to ensure we dont end up with multiple connections 2015-02-26 16:33:17 -06:00
Pratik Naik d96ea7c5e4 Never stop attempting to reconnect 2015-02-26 15:52:45 -06:00
Pratik Naik 359f006bac Reconnect the websocket if the server doesnt send a ping every 6 seconds 2015-02-26 14:25:34 -06:00