actioncable 5.0.0.rc2 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6b94adefd33df52bd3071fc352f3e02005f5f3d
4
- data.tar.gz: a92b0ef36b341b4c69e886c74aca629187ba6237
3
+ metadata.gz: 78aa5e9accaff5552c65b7c806c3d313b4910278
4
+ data.tar.gz: 58b3076e4b69b419e845efc1ff101e4b02ca4a4c
5
5
  SHA512:
6
- metadata.gz: af38e63777c21351f22aa57d2f5599a6bc39fffb2ba39950c57c46c93f23ebbef390b8290bc9cf68e464004d2aab1b9d47f447cf33fb3527250fbb3e58175759
7
- data.tar.gz: 771f3def063419544f25963795cb3c972467a7de86d5f002be0147922399ed353ad602c924aaeb299174df7734aace7a22d1811d05460e0cbc419989f9837ad8
6
+ metadata.gz: 46536e637511c425470ed54cb722ef9f99966714fdef30c56dbddb5c851fa01036e09b33020e116e96d593159ecf4d0315ab6f7775b60577aca17b03e85e0918
7
+ data.tar.gz: a4ae8816e81c14050d369735648d80185b224ecc86bf9f9133e6d6f1d071046d66a2e2890bf23ab1b44f724266d5f354851fab3c1393782bb17725fa37112b33
data/CHANGELOG.md CHANGED
@@ -1,19 +1,10 @@
1
- ## Rails 5.0.0.rc2 (June 22, 2016) ##
1
+ ## Rails 5.0.0 (June 30, 2016) ##
2
2
 
3
+ * Fix development reloading support: new cable connections are now correctly
4
+ dispatched to the reloaded channel class, instead of using a cached reference
5
+ to the originally-loaded version.
3
6
 
4
- * Fix development reloading support: new cable connections are now correctly
5
- dispatched to the reloaded channel class, instead of using a cached reference
6
- to the originally-loaded version.
7
-
8
- *Matthew Draper*
9
-
10
-
11
- ## Rails 5.0.0.rc1 (May 06, 2016) ##
12
-
13
- * No changes.
14
-
15
-
16
- ## Rails 5.0.0.beta4 (April 27, 2016) ##
7
+ *Matthew Draper*
17
8
 
18
9
  * WebSocket protocol negotiation.
19
10
 
@@ -58,8 +49,6 @@
58
49
 
59
50
  *Jay Hayes*
60
51
 
61
- ## Rails 5.0.0.beta3 (February 24, 2016) ##
62
-
63
52
  * Added `em_redis_connector` and `redis_connector` to
64
53
  `ActionCable::SubscriptionAdapter::EventedRedis` and added `redis_connector`
65
54
  to `ActionCable::SubscriptionAdapter::Redis`, so you can overwrite with your
@@ -68,8 +57,6 @@
68
57
 
69
58
  *DHH*
70
59
 
71
- ## Rails 5.0.0.beta2 (February 01, 2016) ##
72
-
73
60
  * Support PostgreSQL pubsub adapter.
74
61
 
75
62
  *Jon Moss*
@@ -91,8 +78,6 @@
91
78
 
92
79
  *Jon Moss*
93
80
 
94
- ## Rails 5.0.0.beta1 (December 18, 2015) ##
95
-
96
81
  * Added to Rails!
97
82
 
98
83
  *DHH*
data/README.md CHANGED
@@ -455,6 +455,74 @@ with all the popular application servers -- Unicorn, Puma and Passenger.
455
455
  Action Cable does not work with WEBrick, because WEBrick does not support the
456
456
  Rack socket hijacking API.
457
457
 
458
+ ## Frontend assets
459
+
460
+ Action Cable's frontend assets are distributed through two channels: the
461
+ official gem and npm package, both titled `actioncable`.
462
+
463
+ ### Gem usage
464
+
465
+ Through the `actioncable` gem, Action Cable's frontend assets are
466
+ available through the Rails Asset Pipeline. Create a `cable.js` or
467
+ `cable.coffee` file (this is automatically done for you with Rails
468
+ generators), and then simply require the assets:
469
+
470
+ In JavaScript...
471
+
472
+ ```javascript
473
+ //= require action_cable
474
+ ```
475
+
476
+ ... and in CoffeeScript:
477
+
478
+ ```coffeescript
479
+ #= require action_cable
480
+ ```
481
+
482
+ ### npm usage
483
+
484
+ In addition to being available through the `actioncable` gem, Action Cable's
485
+ frontend JS assets are also bundled in an officially supported npm module,
486
+ intended for usage in standalone frontend applications that communicate with a
487
+ Rails application. A common use case for this could be if you have a decoupled
488
+ frontend application written in React, Ember.js, etc. and want to add real-time
489
+ WebSocket functionality.
490
+
491
+ ### Installation
492
+
493
+ ```
494
+ npm install actioncable --save
495
+ ```
496
+
497
+ ### Usage
498
+
499
+ The `ActionCable` constant is available as a `require`-able module, so
500
+ you only have to require the package to gain access to the API that is
501
+ provided.
502
+
503
+ In JavaScript...
504
+
505
+ ```javascript
506
+ ActionCable = require('actioncable')
507
+
508
+ var cable = ActionCable.createConsumer('wss://RAILS-API-PATH.com/cable')
509
+
510
+ cable.subscriptions.create('AppearanceChannel', {
511
+ // normal channel code goes here...
512
+ });
513
+ ```
514
+
515
+ and in CoffeeScript...
516
+
517
+ ```coffeescript
518
+ ActionCable = require('actioncable')
519
+
520
+ cable = ActionCable.createConsumer('wss://RAILS-API-PATH.com/cable')
521
+
522
+ cable.subscriptions.create 'AppearanceChannel',
523
+ # normal channel code goes here...
524
+ ```
525
+
458
526
  ## License
459
527
 
460
528
  Action Cable is released under the MIT license:
@@ -64,9 +64,7 @@ module ActionCable
64
64
 
65
65
  def start_periodic_timer(callback, every:)
66
66
  connection.server.event_loop.timer every do
67
- connection.worker_pool.async_invoke connection do
68
- instance_exec(&callback)
69
- end
67
+ connection.worker_pool.async_exec self, connection: connection, &callback
70
68
  end
71
69
  end
72
70
 
@@ -8,7 +8,7 @@ module ActionCable
8
8
  MAJOR = 5
9
9
  MINOR = 0
10
10
  TINY = 0
11
- PRE = "rc2"
11
+ PRE = nil
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -42,16 +42,20 @@ module ActionCable
42
42
  self.connection = nil
43
43
  end
44
44
 
45
- def async_invoke(receiver, method, *args, connection: receiver)
45
+ def async_exec(receiver, *args, connection:, &block)
46
+ async_invoke receiver, :instance_exec, *args, connection: connection, &block
47
+ end
48
+
49
+ def async_invoke(receiver, method, *args, connection: receiver, &block)
46
50
  @executor.post do
47
- invoke(receiver, method, *args, connection: connection)
51
+ invoke(receiver, method, *args, connection: connection, &block)
48
52
  end
49
53
  end
50
54
 
51
- def invoke(receiver, method, *args, connection:)
55
+ def invoke(receiver, method, *args, connection:, &block)
52
56
  work(connection) do
53
57
  begin
54
- receiver.send method, *args
58
+ receiver.send method, *args, &block
55
59
  rescue Exception => e
56
60
  logger.error "There was an exception - #{e.class}(#{e.message})"
57
61
  logger.error e.backtrace.join("\n")
@@ -52,6 +52,14 @@
52
52
  }
53
53
  };
54
54
 
55
+ if (typeof window !== "undefined" && window !== null) {
56
+ window.ActionCable = this.ActionCable;
57
+ }
58
+
59
+ if (typeof module !== "undefined" && module !== null) {
60
+ module.exports = this.ActionCable;
61
+ }
62
+
55
63
  }).call(this);
56
64
  (function() {
57
65
  var bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actioncable
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.rc2
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pratik Naik
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-22 00:00:00.000000000 Z
12
+ date: 2016-06-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 5.0.0.rc2
20
+ version: 5.0.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 5.0.0.rc2
27
+ version: 5.0.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: nio4r
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -145,9 +145,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
145
145
  version: 2.2.2
146
146
  required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - ">"
148
+ - - ">="
149
149
  - !ruby/object:Gem::Version
150
- version: 1.3.1
150
+ version: '0'
151
151
  requirements: []
152
152
  rubyforge_project:
153
153
  rubygems_version: 2.6.4