pubnub 3.7.7 → 3.7.9
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 +4 -4
- data/CHANGELOG.txt +7 -0
- data/Gemfile.lock +2 -2
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/pubnub/client.rb +3 -0
- data/lib/pubnub/event.rb +38 -9
- data/lib/pubnub/formatter.rb +1 -1
- data/lib/pubnub/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62193ab10214d59518c9062bc59e8c3c8d2f1734
|
4
|
+
data.tar.gz: 853adb652e08e97ae375053f4c946820ee6af4f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fb7d4e826de2989190dc60ba0e04eba377ab46300cc13f1ab506e4eca0bb825fb06a04caa412384df76716a950429adadbe8480b10b336c51c2b7c6acca8eaa
|
7
|
+
data.tar.gz: 9b137577a94359da14c6e044e0cba58fe06300fc1938826ef5c2dc811ca8e55d394eb959a2d356d5b120e3cdd4a71b87cf47c30580a01a3bb117731f501abe21
|
data/CHANGELOG.txt
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Give it a try and share with us your thoughts!
|
|
6
6
|
|
7
7
|
# Please direct all Support Questions and Concerns to Support@PubNub.com
|
8
8
|
|
9
|
-
## PubNub Gem version 3.7.
|
9
|
+
## PubNub Gem version 3.7.9
|
10
10
|
|
11
11
|
##### YOU MUST HAVE A PUBNUB ACCOUNT TO USE THE API.
|
12
12
|
##### http://www.pubnub.com/account
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.7.
|
1
|
+
3.7.9
|
data/lib/pubnub/client.rb
CHANGED
@@ -211,6 +211,7 @@ module Pubnub
|
|
211
211
|
end
|
212
212
|
|
213
213
|
def update_timetoken(timetoken)
|
214
|
+
@env[:connect_callback].call "New connection to #{@origin}" if @env[:timetoken] == 0 && @env[:connect_callback]
|
214
215
|
@env[:timetoken] = timetoken.to_i
|
215
216
|
Pubnub.logger.debug(:pubnub){"Pubnub::Client#update_timetoken | Current timetoken is eq #{@env[:timetoken]}"}
|
216
217
|
end
|
@@ -312,6 +313,7 @@ module Pubnub
|
|
312
313
|
@env = symbolize_options_keys(options)
|
313
314
|
@env = set_default_values(@env)
|
314
315
|
@env.delete_if { |_,v| v.blank? } # nillify if blank
|
316
|
+
@env[:timetoken] = 0
|
315
317
|
@async_events = Array.new
|
316
318
|
Pubnub.logger.debug(:pubnub){"\n\nCreated new Pubnub::Client instance"}
|
317
319
|
end
|
@@ -333,6 +335,7 @@ module Pubnub
|
|
333
335
|
:subscribe_timeout => DEFAULT_SUBSCRIBE_TIMEOUT,
|
334
336
|
:timeout => DEFAULT_NON_SUBSCRIBE_TIMEOUT,
|
335
337
|
:max_retries => MAX_RETRIES,
|
338
|
+
:retries_interval => RETRIES_INTERVAL,
|
336
339
|
:non_subscribe_timeout => DEFAULT_NON_SUBSCRIBE_TIMEOUT,
|
337
340
|
:reconnect_max_attempts => DEFAULT_RECONNECT_ATTEMPTS,
|
338
341
|
:reconnect_retry_interval => DEFAULT_RECONNECT_INTERVAL,
|
data/lib/pubnub/event.rb
CHANGED
@@ -34,6 +34,14 @@ module Pubnub
|
|
34
34
|
Pubnub.logger.debug(:pubnub){"Event#initialize | Initialized #{self.class.to_s}"}
|
35
35
|
end
|
36
36
|
|
37
|
+
def secure_call(lambda, parameter)
|
38
|
+
begin
|
39
|
+
lambda.call parameter
|
40
|
+
rescue => e
|
41
|
+
Pubnub.logger.error(:pubnub){"Can't fire callback because: #{e}"}
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
37
45
|
def fire(app)
|
38
46
|
Pubnub.logger.debug(:pubnub){'Pubnub::Event#fire'}
|
39
47
|
@fired = true
|
@@ -69,10 +77,13 @@ module Pubnub
|
|
69
77
|
end
|
70
78
|
rescue => e
|
71
79
|
Pubnub.logger.error(:pubnub){e.inspect}
|
80
|
+
sleep app.env[:retries_interval]
|
72
81
|
if count <= app.env[:max_retries]
|
73
82
|
start_event(app, count + 1)
|
74
83
|
else
|
75
84
|
Pubnub.logger.error(:pubnub){"Aborting #{self.class} event due to network errors and reaching max retries"}
|
85
|
+
app.env[:subscribe_railgun].cancel if app.env[:subscribe_railgun]
|
86
|
+
app.env[:subscribe_railgun] = nil
|
76
87
|
end
|
77
88
|
false
|
78
89
|
end
|
@@ -136,12 +147,12 @@ module Pubnub
|
|
136
147
|
Pubnub.logger.debug(:pubnub){'Firing callbacks'}
|
137
148
|
# EM.defer do
|
138
149
|
envelopes.each do |envelope|
|
139
|
-
@callback
|
150
|
+
secure_call(@callback, envelope) if envelope && !envelope.error && @callback && !envelope.timetoken_update
|
140
151
|
#if envelope.timetoken_update || envelope.timetoken.to_i > app.env[:timetoken].to_i
|
141
152
|
# update_timetoken(app, envelope.timetoken)
|
142
153
|
#end
|
143
154
|
end
|
144
|
-
|
155
|
+
secure_call(@error_callback, envelopes.first) if envelopes.first.error
|
145
156
|
# end
|
146
157
|
else
|
147
158
|
Pubnub.logger.debug(:pubnub){'No envelopes for callback'}
|
@@ -523,18 +534,37 @@ module Pubnub
|
|
523
534
|
Pubnub.logger.debug(:pubnub){'Event#fire_callbacks async'}
|
524
535
|
envelopes.each do |envelope|
|
525
536
|
if group_envelope?(envelope, app) # WITH GROUP
|
526
|
-
|
537
|
+
secure_call(
|
538
|
+
app.env[:callbacks_pool][:channel_group][@origin][envelope.channel_group][:callback],
|
539
|
+
envelope
|
540
|
+
) if !envelope.error && !envelope.timetoken_update
|
527
541
|
elsif channel_envelope?(envelope, app) # CHANNEL SUBSCRIBE
|
528
|
-
|
542
|
+
secure_call(
|
543
|
+
app.env[:callbacks_pool][:channel][@origin][encode_channel(envelope.channel)][:callback],
|
544
|
+
envelope
|
545
|
+
) if !envelope.error && !envelope.timetoken_update
|
529
546
|
elsif wc_pnpres_envelope(envelope, app) # wildcard pnpres
|
530
|
-
|
547
|
+
secure_call(
|
548
|
+
app.env[:callbacks_pool][:wildcard_channel][@origin][encode_channel(envelope.wildcard_channel)][:presence_callback],
|
549
|
+
envelope
|
550
|
+
) if !envelope.error && !envelope.timetoken_update
|
531
551
|
elsif wc_envelope?(envelope, app) # wildcard
|
532
|
-
|
552
|
+
secure_call(
|
553
|
+
app.env[:callbacks_pool][:wildcard_channel][@origin][encode_channel(envelope.wildcard_channel)][:callback],
|
554
|
+
envelope
|
555
|
+
) if !envelope.error && !envelope.timetoken_update
|
533
556
|
end
|
534
557
|
end
|
535
558
|
Pubnub.logger.debug(:pubnub){'We can send next request now'}
|
536
|
-
|
537
|
-
|
559
|
+
secure_call(
|
560
|
+
app.env[:error_callbacks_pool][:channel][@origin],
|
561
|
+
envelopes.first
|
562
|
+
) if envelopes.first.error && !envelopes.first.channel_group
|
563
|
+
|
564
|
+
secure_call(
|
565
|
+
app.env[:error_callbacks_pool][:channel_group][@origin],
|
566
|
+
envelopes.first
|
567
|
+
) if envelopes.first.error && envelopes.first.channel_group
|
538
568
|
|
539
569
|
rescue => error
|
540
570
|
Pubnub.logger.error(:pubnub){error}
|
@@ -706,7 +736,6 @@ module Pubnub
|
|
706
736
|
connection = Net::HTTP::Persistent.new "pubnub_ruby_client_v#{Pubnub::VERSION}"
|
707
737
|
connection.idle_timeout = app.env[:subscribe_timeout]
|
708
738
|
connection.read_timeout = app.env[:subscribe_timeout]
|
709
|
-
@connect_callback.call "New connection to #{@origin}"
|
710
739
|
connection.proxy_from_env
|
711
740
|
connection
|
712
741
|
end
|
data/lib/pubnub/formatter.rb
CHANGED
data/lib/pubnub/version.rb
CHANGED
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: 3.7.
|
4
|
+
version: 3.7.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PubNub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|