pubnub 4.0.20 → 4.0.21

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pubnub might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c7bebb2ecbf997c91f41cd489c1de9eec5bfde5
4
- data.tar.gz: 01c2404c91426777658f11266ca1cce15daa767c
3
+ metadata.gz: 3a00f68d0e493807b33f22560d5cacfb4fede783
4
+ data.tar.gz: 82f017d06fb21f79fa9e119464a364191abe32d0
5
5
  SHA512:
6
- metadata.gz: 9c87b0e9d8c46932808f898968447f3f19c513b93692d462da2c055192801474877f4bbc1d1a12ad3fe7a7e3112943980c46af575b9c30acf85ecc4403fa954c
7
- data.tar.gz: bf6348afa43661507a50be84801d7b59a4b74505f1629e7e079bc8b5137f9ba223f6e14b60477e2db5cd25035b749371c81e3c8b222181e6208b871577168e82
6
+ metadata.gz: 6e5fce4d22e00cb14966788e1f18cb9ce2e7ced7df732f5a66384f016e083c26148730b651d6a65d7e112e246dbf1a8aa749351a744bdacdb1e9a294c672f37b
7
+ data.tar.gz: 29d15a7fbe35e9fe6cc940f3dcff96bd680027adf40855680cca5e53ee413c8dfb9d9129657c7cb6db8d36b7de9172ca2fc7ba61d4fe3af9a364244000a9df84
@@ -1,5 +1,13 @@
1
1
  ---
2
+ version: "4.0.21"
2
3
  changelog:
4
+ -
5
+ changes:
6
+ -
7
+ text: "Fixed signature generation"
8
+ type: bug
9
+ date: 18-04-2017
10
+ version: 4.0.21
3
11
  -
4
12
  changes:
5
13
  -
@@ -232,4 +240,3 @@ supported-platforms:
232
240
  name: ruby
233
241
  schema: 1
234
242
  scm: github.com/pubnub/ruby
235
- version: "4.0.20"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pubnub (4.0.19)
4
+ pubnub (4.0.20)
5
5
  celluloid (~> 0.17)
6
6
  dry-validation (~> 0.10)
7
7
  httpclient (~> 2.8)
@@ -36,7 +36,6 @@ GEM
36
36
  simplecov
37
37
  coderay (1.1.0)
38
38
  concurrent-ruby (1.0.5)
39
- concurrent-ruby (1.0.5-java)
40
39
  crack (0.4.2)
41
40
  safe_yaml (~> 1.0.0)
42
41
  diff-lcs (1.2.5)
@@ -70,7 +69,6 @@ GEM
70
69
  dry-types (~> 0.9, >= 0.9.0)
71
70
  ffi (1.9.10-java)
72
71
  hitimes (1.2.4)
73
- hitimes (1.2.4-java)
74
72
  httpclient (2.8.3)
75
73
  inflecto (0.0.2)
76
74
  json (2.0.2)
@@ -147,4 +145,4 @@ DEPENDENCIES
147
145
  webmock
148
146
 
149
147
  BUNDLED WITH
150
- 1.14.4
148
+ 1.14.6
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.20
1
+ 4.0.21
@@ -0,0 +1,83 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ps.pndsn.com/v2/subscribe/demo/demo/0?pnsdk=PubNub-Ruby/4.0.20&t=%7B%22r%22:0,%22t%22:0%7D&uuid=eb901cf8-6979-4123-9e30-9f3fd60f7c47
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
12
+ Accept:
13
+ - "*/*"
14
+ Date:
15
+ - Thu, 13 Apr 2017 14:34:53 GMT
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Thu, 13 Apr 2017 14:34:53 GMT
23
+ Content-Type:
24
+ - text/javascript; charset="UTF-8"
25
+ Content-Length:
26
+ - '45'
27
+ Connection:
28
+ - keep-alive
29
+ Cache-Control:
30
+ - no-cache
31
+ Access-Control-Allow-Origin:
32
+ - "*"
33
+ Access-Control-Allow-Methods:
34
+ - GET
35
+ body:
36
+ encoding: UTF-8
37
+ string: '{"t":{"t":"14920940259937049","r":12},"m":[]}'
38
+ http_version:
39
+ recorded_at: Thu, 13 Apr 2017 14:34:53 GMT
40
+ - request:
41
+ method: get
42
+ uri: http://ps.pndsn.com/v2/presence/sub-key/demo/channel/demo/leave?pnsdk=PubNub-Ruby/4.0.20&uuid=eb901cf8-6979-4123-9e30-9f3fd60f7c47
43
+ body:
44
+ encoding: UTF-8
45
+ string: ''
46
+ headers:
47
+ User-Agent:
48
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
49
+ Accept:
50
+ - "*/*"
51
+ Date:
52
+ - Thu, 13 Apr 2017 14:34:54 GMT
53
+ response:
54
+ status:
55
+ code: 200
56
+ message: OK
57
+ headers:
58
+ Date:
59
+ - Thu, 13 Apr 2017 14:34:55 GMT
60
+ Content-Type:
61
+ - text/javascript; charset="UTF-8"
62
+ Content-Length:
63
+ - '74'
64
+ Connection:
65
+ - keep-alive
66
+ Access-Control-Allow-Origin:
67
+ - "*"
68
+ Access-Control-Allow-Methods:
69
+ - OPTIONS, GET, POST
70
+ Cache-Control:
71
+ - no-cache
72
+ Accept-Ranges:
73
+ - bytes
74
+ Age:
75
+ - '0'
76
+ Server:
77
+ - Pubnub Presence
78
+ body:
79
+ encoding: UTF-8
80
+ string: '{"status": 200, "message": "OK", "action": "leave", "service": "Presence"}'
81
+ http_version:
82
+ recorded_at: Thu, 13 Apr 2017 14:34:55 GMT
83
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,157 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ps.pndsn.com/v2/subscribe/demo/demo/0?pnsdk=PubNub-Ruby/4.0.20&t=%7B%22r%22:0,%22t%22:0%7D&uuid=1206c3b2-79b6-43d4-a26a-847614ea6986
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
12
+ Accept:
13
+ - "*/*"
14
+ Date:
15
+ - Thu, 13 Apr 2017 14:35:07 GMT
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Thu, 13 Apr 2017 14:35:07 GMT
23
+ Content-Type:
24
+ - text/javascript; charset="UTF-8"
25
+ Content-Length:
26
+ - '45'
27
+ Connection:
28
+ - keep-alive
29
+ Cache-Control:
30
+ - no-cache
31
+ Access-Control-Allow-Origin:
32
+ - "*"
33
+ Access-Control-Allow-Methods:
34
+ - GET
35
+ body:
36
+ encoding: UTF-8
37
+ string: '{"t":{"t":"14920941063440382","r":12},"m":[]}'
38
+ http_version:
39
+ recorded_at: Thu, 13 Apr 2017 14:35:07 GMT
40
+ - request:
41
+ method: get
42
+ uri: http://ps.pndsn.com/v2/presence/sub-key/demo/channel/demo/leave?pnsdk=PubNub-Ruby/4.0.20&uuid=1206c3b2-79b6-43d4-a26a-847614ea6986
43
+ body:
44
+ encoding: UTF-8
45
+ string: ''
46
+ headers:
47
+ User-Agent:
48
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
49
+ Accept:
50
+ - "*/*"
51
+ Date:
52
+ - Thu, 13 Apr 2017 14:35:08 GMT
53
+ response:
54
+ status:
55
+ code: 200
56
+ message: OK
57
+ headers:
58
+ Date:
59
+ - Thu, 13 Apr 2017 14:35:09 GMT
60
+ Content-Type:
61
+ - text/javascript; charset="UTF-8"
62
+ Content-Length:
63
+ - '74'
64
+ Connection:
65
+ - keep-alive
66
+ Access-Control-Allow-Origin:
67
+ - "*"
68
+ Access-Control-Allow-Methods:
69
+ - OPTIONS, GET, POST
70
+ Cache-Control:
71
+ - no-cache
72
+ Accept-Ranges:
73
+ - bytes
74
+ Age:
75
+ - '0'
76
+ Server:
77
+ - Pubnub Presence
78
+ body:
79
+ encoding: UTF-8
80
+ string: '{"status": 200, "message": "OK", "action": "leave", "service": "Presence"}'
81
+ http_version:
82
+ recorded_at: Thu, 13 Apr 2017 14:35:09 GMT
83
+ - request:
84
+ method: get
85
+ uri: http://ps.pndsn.com/v2/subscribe/demo/demo/0?pnsdk=PubNub-Ruby/4.0.20&t=%7B%22r%22:12,%22t%22:%2214920941063440382%22%7D&uuid=1206c3b2-79b6-43d4-a26a-847614ea6986
86
+ body:
87
+ encoding: UTF-8
88
+ string: ''
89
+ headers:
90
+ User-Agent:
91
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
92
+ Accept:
93
+ - "*/*"
94
+ Date:
95
+ - Thu, 13 Apr 2017 14:35:07 GMT
96
+ response:
97
+ status:
98
+ code: 200
99
+ message: OK
100
+ headers:
101
+ Date:
102
+ - Thu, 13 Apr 2017 14:35:09 GMT
103
+ Content-Type:
104
+ - text/javascript; charset="UTF-8"
105
+ Content-Length:
106
+ - '215'
107
+ Connection:
108
+ - keep-alive
109
+ Cache-Control:
110
+ - no-cache
111
+ Access-Control-Allow-Origin:
112
+ - "*"
113
+ Access-Control-Allow-Methods:
114
+ - GET
115
+ body:
116
+ encoding: UTF-8
117
+ string: '{"t":{"t":"14920941095453989","r":12},"m":[{"a":"1","f":514,"i":"1206c3b2-79b6-43d4-a26a-847614ea6986","s":1,"o":{"t":"14920941092189970"},"p":{"t":"14920941095432179","r":12},"k":"demo","c":"demo","d":"whatever"}]}'
118
+ http_version:
119
+ recorded_at: Thu, 13 Apr 2017 14:35:09 GMT
120
+ - request:
121
+ method: get
122
+ uri: http://ps.pndsn.com/publish/demo/demo/0/demo/0/%22whatever%22?ortt=%7B%22t%22:14920941092189970%7D&pnsdk=PubNub-Ruby/4.0.20&seqn=1&uuid=1206c3b2-79b6-43d4-a26a-847614ea6986
123
+ body:
124
+ encoding: UTF-8
125
+ string: ''
126
+ headers:
127
+ User-Agent:
128
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
129
+ Accept:
130
+ - "*/*"
131
+ Date:
132
+ - Thu, 13 Apr 2017 14:35:09 GMT
133
+ response:
134
+ status:
135
+ code: 200
136
+ message: OK
137
+ headers:
138
+ Date:
139
+ - Thu, 13 Apr 2017 14:35:09 GMT
140
+ Content-Type:
141
+ - text/javascript; charset="UTF-8"
142
+ Content-Length:
143
+ - '30'
144
+ Connection:
145
+ - keep-alive
146
+ Cache-Control:
147
+ - no-cache
148
+ Access-Control-Allow-Origin:
149
+ - "*"
150
+ Access-Control-Allow-Methods:
151
+ - GET
152
+ body:
153
+ encoding: UTF-8
154
+ string: '[1,"Sent","14920941095432179"]'
155
+ http_version:
156
+ recorded_at: Thu, 13 Apr 2017 14:35:09 GMT
157
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,157 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ps.pndsn.com/v2/subscribe/demo/demo/0?pnsdk=PubNub-Ruby/4.0.20&t=%7B%22r%22:0,%22t%22:0%7D&uuid=7e7fa6ca-023b-41f1-8153-97b81d27cca0
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
12
+ Accept:
13
+ - "*/*"
14
+ Date:
15
+ - Thu, 13 Apr 2017 14:35:04 GMT
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Thu, 13 Apr 2017 14:35:04 GMT
23
+ Content-Type:
24
+ - text/javascript; charset="UTF-8"
25
+ Content-Length:
26
+ - '45'
27
+ Connection:
28
+ - keep-alive
29
+ Cache-Control:
30
+ - no-cache
31
+ Access-Control-Allow-Origin:
32
+ - "*"
33
+ Access-Control-Allow-Methods:
34
+ - GET
35
+ body:
36
+ encoding: UTF-8
37
+ string: '{"t":{"t":"14920940259937049","r":12},"m":[]}'
38
+ http_version:
39
+ recorded_at: Thu, 13 Apr 2017 14:35:04 GMT
40
+ - request:
41
+ method: get
42
+ uri: http://ps.pndsn.com/v2/presence/sub-key/demo/channel/demo/leave?pnsdk=PubNub-Ruby/4.0.20&uuid=7e7fa6ca-023b-41f1-8153-97b81d27cca0
43
+ body:
44
+ encoding: UTF-8
45
+ string: ''
46
+ headers:
47
+ User-Agent:
48
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
49
+ Accept:
50
+ - "*/*"
51
+ Date:
52
+ - Thu, 13 Apr 2017 14:35:05 GMT
53
+ response:
54
+ status:
55
+ code: 200
56
+ message: OK
57
+ headers:
58
+ Date:
59
+ - Thu, 13 Apr 2017 14:35:05 GMT
60
+ Content-Type:
61
+ - text/javascript; charset="UTF-8"
62
+ Content-Length:
63
+ - '74'
64
+ Connection:
65
+ - keep-alive
66
+ Access-Control-Allow-Origin:
67
+ - "*"
68
+ Access-Control-Allow-Methods:
69
+ - OPTIONS, GET, POST
70
+ Cache-Control:
71
+ - no-cache
72
+ Accept-Ranges:
73
+ - bytes
74
+ Age:
75
+ - '0'
76
+ Server:
77
+ - Pubnub Presence
78
+ body:
79
+ encoding: UTF-8
80
+ string: '{"status": 200, "message": "OK", "action": "leave", "service": "Presence"}'
81
+ http_version:
82
+ recorded_at: Thu, 13 Apr 2017 14:35:05 GMT
83
+ - request:
84
+ method: get
85
+ uri: http://ps.pndsn.com/publish/demo/demo/0/demo/0/%22whatever%22?ortt=%7B%22t%22:14920941061970292%7D&pnsdk=PubNub-Ruby/4.0.20&seqn=1&uuid=7e7fa6ca-023b-41f1-8153-97b81d27cca0
86
+ body:
87
+ encoding: UTF-8
88
+ string: ''
89
+ headers:
90
+ User-Agent:
91
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
92
+ Accept:
93
+ - "*/*"
94
+ Date:
95
+ - Thu, 13 Apr 2017 14:35:06 GMT
96
+ response:
97
+ status:
98
+ code: 200
99
+ message: OK
100
+ headers:
101
+ Date:
102
+ - Thu, 13 Apr 2017 14:35:06 GMT
103
+ Content-Type:
104
+ - text/javascript; charset="UTF-8"
105
+ Content-Length:
106
+ - '30'
107
+ Connection:
108
+ - keep-alive
109
+ Cache-Control:
110
+ - no-cache
111
+ Access-Control-Allow-Origin:
112
+ - "*"
113
+ Access-Control-Allow-Methods:
114
+ - GET
115
+ body:
116
+ encoding: UTF-8
117
+ string: '[1,"Sent","14920941063446551"]'
118
+ http_version:
119
+ recorded_at: Thu, 13 Apr 2017 14:35:06 GMT
120
+ - request:
121
+ method: get
122
+ uri: http://ps.pndsn.com/v2/subscribe/demo/demo/0?pnsdk=PubNub-Ruby/4.0.20&t=%7B%22r%22:12,%22t%22:%2214920940259937049%22%7D&uuid=7e7fa6ca-023b-41f1-8153-97b81d27cca0
123
+ body:
124
+ encoding: UTF-8
125
+ string: ''
126
+ headers:
127
+ User-Agent:
128
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
129
+ Accept:
130
+ - "*/*"
131
+ Date:
132
+ - Thu, 13 Apr 2017 14:35:04 GMT
133
+ response:
134
+ status:
135
+ code: 200
136
+ message: OK
137
+ headers:
138
+ Date:
139
+ - Thu, 13 Apr 2017 14:35:06 GMT
140
+ Content-Type:
141
+ - text/javascript; charset="UTF-8"
142
+ Content-Length:
143
+ - '215'
144
+ Connection:
145
+ - keep-alive
146
+ Cache-Control:
147
+ - no-cache
148
+ Access-Control-Allow-Origin:
149
+ - "*"
150
+ Access-Control-Allow-Methods:
151
+ - GET
152
+ body:
153
+ encoding: UTF-8
154
+ string: '{"t":{"t":"14920941063440382","r":12},"m":[{"a":"1","f":514,"i":"7e7fa6ca-023b-41f1-8153-97b81d27cca0","s":1,"o":{"t":"14920941061970292"},"p":{"t":"14920941063446551","r":12},"k":"demo","c":"demo","d":"whatever"}]}'
155
+ http_version:
156
+ recorded_at: Thu, 13 Apr 2017 14:35:06 GMT
157
+ recorded_with: VCR 3.0.1
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ps.pndsn.com/v2/subscribe/demo/demo/0?pnsdk=PubNub-Ruby/4.0.20&t=%7B%22r%22:0,%22t%22:0%7D&uuid=12ccaa30-98ed-48cc-917a-2f0145ec23c1
6
+ body:
7
+ encoding: UTF-8
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - HTTPClient/1.0 (2.8.3, ruby 2.4.1 (2017-03-22))
12
+ Accept:
13
+ - "*/*"
14
+ Date:
15
+ - Thu, 13 Apr 2017 14:30:23 GMT
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Thu, 13 Apr 2017 14:30:23 GMT
23
+ Content-Type:
24
+ - text/javascript; charset="UTF-8"
25
+ Content-Length:
26
+ - '45'
27
+ Connection:
28
+ - keep-alive
29
+ Cache-Control:
30
+ - no-cache
31
+ Access-Control-Allow-Origin:
32
+ - "*"
33
+ Access-Control-Allow-Methods:
34
+ - GET
35
+ body:
36
+ encoding: UTF-8
37
+ string: '{"t":{"t":"14920929679298175","r":12},"m":[]}'
38
+ http_version:
39
+ recorded_at: Thu, 13 Apr 2017 14:30:23 GMT
40
+ recorded_with: VCR 3.0.1
@@ -317,8 +317,16 @@ module Pubnub
317
317
  case event_type
318
318
  when :subscribe_event
319
319
  hc.receive_timeout = 310
320
+ unless @env[:disable_keepalive] || @env[:disable_subscribe_keepalive]
321
+ hc.keep_alive_timeout = 310
322
+ hc.tcp_keepalive = true
323
+ end
320
324
  when :single_event
321
325
  hc.receive_timeout = 5
326
+ unless @env[:disable_keepalive] || @env[:disable_non_subscribe_keepalive]
327
+ hc.keep_alive_timeout = 310
328
+ hc.tcp_keepalive = true
329
+ end
322
330
  end
323
331
 
324
332
  hc
@@ -16,7 +16,7 @@ module Pubnub
16
16
  variables_for_signature
17
17
  ].join("\n")
18
18
 
19
- message = message.gsub(/[!~*'()]/) { |char| '%' + char.ord.to_s(16).upcase }
19
+ message = message.gsub(/[!~'()]/) { |char| '%' + char.ord.to_s(16).upcase }
20
20
 
21
21
  URI.encode_www_form_component(Base64.encode64(
22
22
  OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'),
@@ -21,7 +21,7 @@ module Pubnub
21
21
  ].join("\n")
22
22
 
23
23
  # Replace ! ~ * ' ( )
24
- message = message.gsub(/[!~*'()]/) { |char| '%' + char.ord.to_s(16).upcase }
24
+ message = message.gsub(/[!~'()]/) { |char| '%' + char.ord.to_s(16).upcase }
25
25
 
26
26
  Base64.urlsafe_encode64(
27
27
  OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'),
@@ -1,4 +1,4 @@
1
1
  # Toplevel Pubnub module.
2
2
  module Pubnub
3
- VERSION = '4.0.20'
3
+ VERSION = '4.0.21'
4
4
  end
@@ -233,54 +233,60 @@ describe Pubnub::Client do
233
233
  end
234
234
  end
235
235
 
236
- # context 'connections pool' do
237
- # let(:pubnub_client) { Pubnub.new(subscribe_key: 'demo', publish_key: 'demo') }
238
- #
239
- # around :each do |example|
240
- # Celluloid.boot
241
- # example.run
242
- # Celluloid.shutdown
243
- # end
244
- #
245
- # context '#connection_for' do
246
- # it 'returns connection for non-subscribe events' do
247
- # VCR.use_cassette('client/connection-for-non-subscribe', :record => :once) do
248
- # pubnub_client.publish(message: :test, channel: :test, http_sync: true)
249
- # end
250
- #
251
- # expect(pubnub_client.env[:single_event_conn_pool]['ps.pndsn.com'].is_a?(Net::HTTP::Persistent)).to eq true
252
- # end
253
- #
254
- # it 'returns connection for subscribe events' do
255
- # VCR.use_cassette('client/connection-for-subscribe', :record => :once) do
256
- # pubnub_client.subscribe(channel: :test, http_sync: true)
257
- # end
258
- #
259
- # expect(pubnub_client.env[:subscribe_event_conn_pool]['ps.pndsn.com'].is_a?(Net::HTTP::Persistent)).to eq true
260
- # end
261
- # end
262
- #
263
- # context '#setup_conn_for' do
264
- # it 'creates connection for non-subscribe events' do
265
- # expect(pubnub_client.env[:single_event_conn_pool]['ps.pndsn.com'].is_a?(NilClass)).to eq true
266
- #
267
- # VCR.use_cassette('client/connection-for-non-subscribe', :record => :once) do
268
- # pubnub_client.publish(message: :test, channel: :test, http_sync: true)
269
- # end
270
- #
271
- # expect(pubnub_client.env[:single_event_conn_pool]['ps.pndsn.com'].is_a?(Net::HTTP::Persistent)).to eq true
272
- # end
273
- #
274
- # it 'creates connection for subscribe events' do
275
- # expect(pubnub_client.env[:subscribe_event_conn_pool]['ps.pndsn.com'].is_a?(NilClass)).to eq true
276
- #
277
- # VCR.use_cassette('client/connection-for-subscribe', :record => :once) do
278
- # pubnub_client.subscribe(channel: :test, http_sync: true)
279
- # end
280
- #
281
- # expect(pubnub_client.env[:subscribe_event_conn_pool]['ps.pndsn.com'].is_a?(Net::HTTP::Persistent)).to eq true
282
- # end
283
- # end
284
- # end
236
+ context 'connections' do
237
+ it 'are keep_alive by default' do
238
+ pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo)
239
+
240
+ VCR.use_cassette('lib/client/keep_alive_default', record: :once) do
241
+ pubnub.subscribe(channel: :demo)
242
+
243
+ eventually { expect(pubnub.env[:req_dispatchers_pool][:async]['ps.pndsn.com'][:subscribe_event].tcp_keepalive).to eq true }
244
+ pubnub.leave(channel: :demo)
245
+
246
+ end
247
+ end
248
+
249
+ it 'respect :disable_keep_alive' do
250
+ pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo, disable_keepalive: true)
251
+
252
+ VCR.use_cassette('lib/client/keep_alive_disabled', record: :once) do
253
+ pubnub.subscribe(channel: :demo)
254
+
255
+ eventually { expect(pubnub.env[:req_dispatchers_pool][:async]['ps.pndsn.com'][:subscribe_event].tcp_keepalive).to eq false }
256
+ pubnub.leave(channel: :demo)
257
+
258
+ end
259
+ end
260
+
261
+ it 'respect :disable_subscribe_keep_alive init parameter' do
262
+ pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo, disable_subscribe_keepalive: true)
263
+
264
+ VCR.use_cassette('lib/client/keep_alive_disable_subscribe_keep_alive', record: :once) do
265
+ pubnub.subscribe(channel: :demo)
266
+
267
+ eventually { expect(pubnub.env[:req_dispatchers_pool][:async]['ps.pndsn.com'][:subscribe_event].tcp_keepalive).to eq false }
268
+ pubnub.leave(channel: :demo)
269
+
270
+ pubnub.publish(channel: :demo, message: :whatever)
271
+ eventually { expect(pubnub.env[:req_dispatchers_pool][:async]['ps.pndsn.com'][:single_event].tcp_keepalive).to eq true }
272
+
273
+ end
274
+ end
275
+
276
+ it 'respect :disable_non_subscribe_keep_alive init parameter' do
277
+ pubnub = Pubnub.new(subscribe_key: :demo, publish_key: :demo, disable_non_subscribe_keepalive: true)
278
+
279
+ VCR.use_cassette('lib/client/keep_alive_disable_non_subscribe_keep_alive', record: :once) do
280
+ pubnub.subscribe(channel: :demo)
281
+
282
+ eventually { expect(pubnub.env[:req_dispatchers_pool][:async]['ps.pndsn.com'][:subscribe_event].tcp_keepalive).to eq true }
283
+ pubnub.leave(channel: :demo)
284
+
285
+ pubnub.publish(channel: :demo, message: :whatever)
286
+ eventually { expect(pubnub.env[:req_dispatchers_pool][:async]['ps.pndsn.com'][:single_event].tcp_keepalive).to eq false }
287
+
288
+ end
289
+ end
290
+ end
285
291
 
286
292
  end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'keep_alive connection' do
4
+
5
+ around :each do |example|
6
+ Celluloid.boot
7
+ example.run
8
+ Celluloid.shutdown
9
+ end
10
+
11
+ it ''
12
+
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubnub
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.20
4
+ version: 4.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - PubNub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-11 00:00:00.000000000 Z
11
+ date: 2017-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid
@@ -10436,6 +10436,10 @@ files:
10436
10436
  - fixtures/vcr_cassettes/examples/where_now/5.yml
10437
10437
  - fixtures/vcr_cassettes/integration/publish/publish-store-replicate.yml
10438
10438
  - fixtures/vcr_cassettes/lib/callable_cipher_key.yml
10439
+ - fixtures/vcr_cassettes/lib/client/keep_alive_default.yml
10440
+ - fixtures/vcr_cassettes/lib/client/keep_alive_disable_non_subscribe_keep_alive.yml
10441
+ - fixtures/vcr_cassettes/lib/client/keep_alive_disable_subscribe_keep_alive.yml
10442
+ - fixtures/vcr_cassettes/lib/client/keep_alive_disabled.yml
10439
10443
  - fixtures/vcr_cassettes/lib/events/audit-error.yml
10440
10444
  - fixtures/vcr_cassettes/lib/events/audit-json-error.yml
10441
10445
  - fixtures/vcr_cassettes/lib/events/audit-works.yml
@@ -10591,6 +10595,7 @@ files:
10591
10595
  - spec/lib/events/time_spec.rb
10592
10596
  - spec/lib/events/timeout_handling_spec.rb
10593
10597
  - spec/lib/events/where_now_spec.rb
10598
+ - spec/lib/keep_alive_spec.rb
10594
10599
  - spec/lib/multiple_ciphers_spec.rb
10595
10600
  - spec/lib/pubnub_spec.rb
10596
10601
  - spec/lib/ssl_error_spec.rb
@@ -10618,7 +10623,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
10618
10623
  version: '0'
10619
10624
  requirements: []
10620
10625
  rubyforge_project:
10621
- rubygems_version: 2.6.11
10626
+ rubygems_version: 2.5.2
10622
10627
  signing_key:
10623
10628
  specification_version: 4
10624
10629
  summary: PubNub Official Ruby gem.
@@ -10660,6 +10665,7 @@ test_files:
10660
10665
  - spec/lib/events/time_spec.rb
10661
10666
  - spec/lib/events/timeout_handling_spec.rb
10662
10667
  - spec/lib/events/where_now_spec.rb
10668
+ - spec/lib/keep_alive_spec.rb
10663
10669
  - spec/lib/multiple_ciphers_spec.rb
10664
10670
  - spec/lib/pubnub_spec.rb
10665
10671
  - spec/lib/ssl_error_spec.rb