action_cable_client 3.0.1 → 3.1.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
  SHA256:
3
- metadata.gz: ef3930c35f391add154d196da2d779e1e51aab9e710c97e138f743cf8aac8be7
4
- data.tar.gz: 81e73f0c6aa96c39d2aafac68e03f08f3c15f7920bba10449711dc28cb21bddd
3
+ metadata.gz: fa0c15dc6f8b9a9a6c0643090cac82c9ee0f2f36522b0a086433f3c852396c65
4
+ data.tar.gz: 0b0dc2baf9515ff563ecd9f2b2b66b35b29afb2ae33f428ab79b91109d5aa1a9
5
5
  SHA512:
6
- metadata.gz: 3a8835181f1d80da858441ad174571642791b5491cb734cdb9c9c660248d0d02b611000c18d456a1c20a6dab0502986226b30931e52bd2c1c7948c3242d7b00b
7
- data.tar.gz: 4c5135c08c26bf4bb12dc3289b5bc024b03efa962b0617f6a21493b44683bec046dc8007971c5eb4cc76a21b69a14b3df996ee09b5fb5becbd0818f02eab9fef
6
+ metadata.gz: f51b7a5e089987b064c7ea136b0521749ea65ce44fa3b90d9a72cf75e3ca2f07defc8f3e6c773837764dae257c4d61765fdbc991f1fb44ec6cd7e9bed6751106
7
+ data.tar.gz: 3961a4a422c32d0e3464942aed22659a5326ccb4346b05532e4344bfe98c47ed941f212d9cd62950c081488bc1de98312c0e508d13b60f3265be7a28878e0520
@@ -1,6 +1,6 @@
1
1
  ## 3.0.1
2
2
 
3
- * [#27](https://github.com/NullVoxPopuli/action_cable_client/pull/27)
3
+ * [#27](https://github.com/NullVoxPopuli/action_cable_client/pull/27) ([@neomilium](https://github.com/neomilium))
4
4
  * Implement reconnect
5
5
  * Fix issue with subscribing only working on initial connection
6
6
  * Additional Tests
@@ -8,13 +8,13 @@
8
8
 
9
9
  ## 2.0.2
10
10
 
11
- * [#24](https://github.com/NullVoxPopuli/action_cable_client/pull/24) Fix bug where action cable client is too fast for the server and doesn't wait for the server's welcome message before initiating a channel subscription (@wpp)
11
+ * [#24](https://github.com/NullVoxPopuli/action_cable_client/pull/24) Fix bug where action cable client is too fast for the server and doesn't wait for the server's welcome message before initiating a channel subscription ([@wpp](https://github.com/wpp))
12
12
 
13
13
  ## 2.0.1
14
14
 
15
15
  **General**
16
16
 
17
- * [#22](https://github.com/NullVoxPopuli/action_cable_client/pull/22) Removed ActiveSupport Dependency (@srabuini)
17
+ * [#22](https://github.com/NullVoxPopuli/action_cable_client/pull/22) Removed ActiveSupport Dependency ([@srabuini](https://github.com/srabuini))
18
18
 
19
19
  ## 2.0
20
20
 
data/README.md CHANGED
@@ -88,6 +88,16 @@ client = ActionCableClient.new(uri, params, true, {
88
88
  })
89
89
  ```
90
90
 
91
+ #### Using TLS
92
+
93
+ Example given for client certificate authentication. See EventMachine::Connection#start_tls documentation for other options.
94
+
95
+ ```ruby
96
+ params = { channel: 'RoomChannel', favorite_color: 'blue' }
97
+ tls = {cert_chain_file: 'user.crt', private_key_file: 'user.key'}
98
+ client = ActionCableClient.new(uri, params, true, nil, tls)
99
+ ```
100
+
91
101
 
92
102
  ## Demo
93
103
 
@@ -35,17 +35,18 @@ class ActionCableClient
35
35
  # @param [Boolean] connect_on_start - connects on init when true
36
36
  # - otherwise manually call `connect!`
37
37
  # @param [Hash] headers - HTTP headers to use in the handshake
38
- def initialize(uri, params = '', connect_on_start = true, headers = {})
38
+ # @param [Hash] tls - TLS options hash to be passed to EM start_tls
39
+ def initialize(uri, params = '', connect_on_start = true, headers = {}, tls = {})
39
40
  @_uri = uri
40
41
  @message_queue = []
41
42
  @_subscribed = false
42
43
 
43
44
  @_message_factory = MessageFactory.new(params)
44
45
 
45
- connect!(headers) if connect_on_start
46
+ connect!(headers, tls) if connect_on_start
46
47
  end
47
48
 
48
- def connect!(headers = {})
49
+ def connect!(headers = {}, tls = {})
49
50
  # Quick Reference for WebSocket::EM::Client's api
50
51
  # - onopen - called after successfully connecting
51
52
  # - onclose - called after closing connection
@@ -58,7 +59,7 @@ class ActionCableClient
58
59
  # - close - closes the connection and optionally sends close frame to server. `close(code, data)`
59
60
  # - ping - sends a ping
60
61
  # - pong - sends a pong
61
- @_websocket_client = WebSocket::EventMachine::Client.connect(uri: @_uri, headers: headers)
62
+ @_websocket_client = WebSocket::EventMachine::Client.connect(uri: @_uri, headers: headers, tls: tls)
62
63
 
63
64
  @_websocket_client.onclose do
64
65
  self._subscribed = false
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ActionCableClient
4
- VERSION = '3.0.1'
4
+ VERSION = '3.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_cable_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - L. Preston Sego III
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-12 00:00:00.000000000 Z
11
+ date: 2019-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket-eventmachine-client
@@ -113,9 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  requirements: []
116
- rubyforge_project:
117
- rubygems_version: 2.7.6
116
+ rubygems_version: 3.0.3
118
117
  signing_key:
119
118
  specification_version: 4
120
- summary: ActionCableClient-3.0.1
119
+ summary: ActionCableClient-3.1.0
121
120
  test_files: []