pubnub 4.0.27 → 4.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pubnub might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.pubnub.yml +8 -1
- data/.rubocop.yml +9 -3
- data/.travis.yml +6 -19
- data/CHANGELOG.md +86 -82
- data/Gemfile +7 -5
- data/Gemfile.lock +155 -157
- data/README.md +34 -34
- data/VERSION +1 -1
- data/gemfiles/celluloid_017.gemfile +4 -4
- data/gemfiles/celluloid_018.gemfile +4 -4
- data/gemfiles/celluloid_master.gemfile +4 -4
- data/gemfiles/concurrent-ruby-1.0.5.gem +0 -0
- data/gemfiles/concurrent-ruby-edge-0.3.1.gem +0 -0
- data/lib/pubnub.rb +3 -3
- data/lib/pubnub/client.rb +19 -16
- data/lib/pubnub/client/events.rb +5 -5
- data/lib/pubnub/client/getters_setters.rb +11 -12
- data/lib/pubnub/client/paged_history.rb +11 -9
- data/lib/pubnub/configuration.rb +1 -2
- data/lib/pubnub/constants.rb +47 -47
- data/lib/pubnub/crypto.rb +2 -2
- data/lib/pubnub/envelope.rb +7 -5
- data/lib/pubnub/error.rb +22 -15
- data/lib/pubnub/event.rb +24 -25
- data/lib/pubnub/event/formatter.rb +8 -5
- data/lib/pubnub/event/signature.rb +3 -3
- data/lib/pubnub/events/audit.rb +1 -1
- data/lib/pubnub/events/channel_registration.rb +10 -15
- data/lib/pubnub/events/delete_messages.rb +9 -9
- data/lib/pubnub/events/grant.rb +3 -3
- data/lib/pubnub/events/heartbeat.rb +4 -8
- data/lib/pubnub/events/here_now.rb +4 -8
- data/lib/pubnub/events/history.rb +10 -10
- data/lib/pubnub/events/leave.rb +2 -2
- data/lib/pubnub/events/presence.rb +1 -1
- data/lib/pubnub/events/publish.rb +3 -5
- data/lib/pubnub/events/revoke.rb +3 -3
- data/lib/pubnub/events/set_state.rb +3 -3
- data/lib/pubnub/events/state.rb +4 -6
- data/lib/pubnub/events/subscribe.rb +1 -1
- data/lib/pubnub/events/time.rb +2 -2
- data/lib/pubnub/events/where_now.rb +6 -6
- data/lib/pubnub/format.rb +73 -0
- data/lib/pubnub/formatter.rb +23 -21
- data/lib/pubnub/heart.rb +4 -4
- data/lib/pubnub/origin_manager.rb +3 -5
- data/lib/pubnub/pam.rb +5 -5
- data/lib/pubnub/schemas/envelope_schema.rb +1 -1
- data/lib/pubnub/subscribe_callback.rb +3 -3
- data/lib/pubnub/subscribe_event.rb +6 -10
- data/lib/pubnub/subscribe_event/formatter.rb +82 -80
- data/lib/pubnub/subscribe_event/heartbeat.rb +1 -1
- data/lib/pubnub/subscriber.rb +31 -32
- data/lib/pubnub/telemetry.rb +26 -27
- data/lib/pubnub/validators/audit.rb +3 -2
- data/lib/pubnub/validators/channel_registration.rb +6 -4
- data/lib/pubnub/validators/client.rb +1 -0
- data/lib/pubnub/validators/common_validator.rb +37 -31
- data/lib/pubnub/validators/delete.rb +5 -4
- data/lib/pubnub/validators/grant.rb +3 -2
- data/lib/pubnub/validators/history.rb +3 -2
- data/lib/pubnub/validators/leave.rb +3 -2
- data/lib/pubnub/validators/presence.rb +3 -2
- data/lib/pubnub/validators/publish.rb +15 -10
- data/lib/pubnub/validators/set_state.rb +0 -2
- data/lib/pubnub/validators/state.rb +3 -2
- data/lib/pubnub/version.rb +1 -1
- data/pubnub.gemspec +19 -18
- data/spec/examples/audit_examples_spec.rb +1268 -1418
- data/spec/examples/channel_registration_examples_spec.rb +655 -757
- data/spec/examples/delete_messages_examples_spec.rb +19 -21
- data/spec/examples/grant_examples_spec.rb +34028 -37920
- data/spec/examples/heartbeat_examples_spec.rb +583 -731
- data/spec/examples/here_now_examples_spec.rb +493 -569
- data/spec/examples/history_examples_spec.rb +979 -1127
- data/spec/examples/leave_examples_spec.rb +439 -551
- data/spec/examples/presence_examples_spec.rb +686 -830
- data/spec/examples/publish_examples_spec.rb +27223 -31547
- data/spec/examples/publish_with_ttl_spec.rb +11 -14
- data/spec/examples/revoke_examples_spec.rb +68048 -75828
- data/spec/examples/set_state_examples_spec.rb +295 -371
- data/spec/examples/state_examples_spec.rb +169 -197
- data/spec/examples/status_request_message_count_exceeded_spec.rb +16 -19
- data/spec/examples/subscribe_examples_spec.rb +43843 -52035
- data/spec/examples/time_examples_spec.rb +82 -98
- data/spec/examples/where_now_examples_spec.rb +88 -104
- data/spec/lib/client_spec.rb +99 -117
- data/spec/lib/connection_callback_spec.rb +27 -33
- data/spec/lib/custom_retries_examples_spec.rb +8 -11
- data/spec/lib/event_spec.rb +35 -42
- data/spec/lib/events/audit_spec.rb +19 -25
- data/spec/lib/events/channel_registration_spec.rb +17 -23
- data/spec/lib/events/delete_messages_spec.rb +14 -20
- data/spec/lib/events/grant_spec.rb +15 -21
- data/spec/lib/events/heartbeat_spec.rb +21 -27
- data/spec/lib/events/here_now_spec.rb +14 -20
- data/spec/lib/events/history_spec.rb +14 -20
- data/spec/lib/events/leave_spec.rb +14 -20
- data/spec/lib/events/presence_delta_spec.rb +15 -16
- data/spec/lib/events/presence_spec.rb +36 -45
- data/spec/lib/events/publish_spec.rb +33 -40
- data/spec/lib/events/revoke_spec.rb +16 -22
- data/spec/lib/events/state_spec.rb +16 -22
- data/spec/lib/events/subscribe_spec.rb +75 -85
- data/spec/lib/events/time_spec.rb +12 -18
- data/spec/lib/events/timeout_handling_spec.rb +8 -14
- data/spec/lib/events/where_now_spec.rb +14 -20
- data/spec/lib/keep_alive_spec.rb +4 -8
- data/spec/lib/multiple_ciphers_spec.rb +56 -60
- data/spec/lib/pubnub_spec.rb +10 -13
- data/spec/lib/signatures_spec.rb +118 -120
- data/spec/lib/ssl_error_spec.rb +14 -18
- data/spec/lib/super_admin_spec.rb +58 -66
- data/spec/lib/uuid_spec.rb +3 -4
- data/spec/spec_expectations.rb +3 -3
- data/spec/spec_helper.rb +29 -46
- metadata +52 -22
- data/lib/pubnub/message.rb +0 -43
@@ -2,7 +2,7 @@
|
|
2
2
|
module Pubnub
|
3
3
|
# Holds history functionality
|
4
4
|
class History < SingleEvent
|
5
|
-
include
|
5
|
+
include Concurrent::Async
|
6
6
|
include Pubnub::Validator::History
|
7
7
|
|
8
8
|
def initialize(options, app)
|
@@ -31,7 +31,7 @@ module Pubnub
|
|
31
31
|
|
32
32
|
def response_message(parsed_response)
|
33
33
|
parsed_response[1]
|
34
|
-
rescue
|
34
|
+
rescue StandardError
|
35
35
|
nil
|
36
36
|
end
|
37
37
|
|
@@ -42,17 +42,17 @@ module Pubnub
|
|
42
42
|
'sub-key',
|
43
43
|
@subscribe_key,
|
44
44
|
'channel',
|
45
|
-
Formatter.channels_for_url(@channel)
|
45
|
+
Formatter.channels_for_url(@channel)
|
46
46
|
].join('/')
|
47
47
|
end
|
48
48
|
|
49
49
|
def parameters(*_args)
|
50
50
|
params = super
|
51
|
-
params
|
52
|
-
params
|
53
|
-
params
|
54
|
-
params
|
55
|
-
params
|
51
|
+
params[:start] = @start if @start
|
52
|
+
params[:end] = @end if @end
|
53
|
+
params[:count] = @count if @count
|
54
|
+
params[:reverse] = 'true' if @reverse
|
55
|
+
params[:include_token] = 'true' if @include_token
|
56
56
|
params
|
57
57
|
end
|
58
58
|
|
@@ -69,9 +69,9 @@ module Pubnub
|
|
69
69
|
finish = parsed_response[2]
|
70
70
|
|
71
71
|
Pubnub::Envelope.new(
|
72
|
-
event:
|
72
|
+
event: @event,
|
73
73
|
event_options: @given_options,
|
74
|
-
timetoken:
|
74
|
+
timetoken: nil,
|
75
75
|
status: {
|
76
76
|
code: req_res_objects[:response].code,
|
77
77
|
client_request: req_res_objects[:request],
|
data/lib/pubnub/events/leave.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
module Pubnub
|
3
3
|
# Holds leave functionality
|
4
4
|
class Leave < SingleEvent
|
5
|
-
include
|
5
|
+
include Concurrent::Async
|
6
6
|
include Pubnub::Validator::Leave
|
7
7
|
|
8
8
|
def initialize(options, app)
|
@@ -37,7 +37,7 @@ module Pubnub
|
|
37
37
|
|
38
38
|
def parameters(*_args)
|
39
39
|
params = super
|
40
|
-
params
|
40
|
+
params['channel-group'] = @group.join(',') unless @group.empty?
|
41
41
|
params
|
42
42
|
end
|
43
43
|
|
@@ -3,7 +3,7 @@ module Pubnub
|
|
3
3
|
# Holds presence functionality, beware, most of presence functionality is
|
4
4
|
# held by SubscribeEvent
|
5
5
|
class Presence < SubscribeEvent
|
6
|
-
include
|
6
|
+
include Concurrent::Async
|
7
7
|
include Pubnub::Validator::Presence
|
8
8
|
|
9
9
|
def initialize(options, app)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module Pubnub
|
3
3
|
# Holds publish functionality
|
4
4
|
class Publish < SingleEvent
|
5
|
-
include
|
5
|
+
include Concurrent::Async
|
6
6
|
include Pubnub::Validator::Publish
|
7
7
|
|
8
8
|
attr_reader :store
|
@@ -36,8 +36,6 @@ module Pubnub
|
|
36
36
|
envelopes = fire_callbacks(handle(response, uri))
|
37
37
|
finalize_event(envelopes)
|
38
38
|
envelopes
|
39
|
-
ensure
|
40
|
-
terminate unless @stay_alive
|
41
39
|
end
|
42
40
|
|
43
41
|
private
|
@@ -88,13 +86,13 @@ module Pubnub
|
|
88
86
|
|
89
87
|
def timetoken(parsed_response)
|
90
88
|
parsed_response[2]
|
91
|
-
rescue
|
89
|
+
rescue StandardError
|
92
90
|
nil
|
93
91
|
end
|
94
92
|
|
95
93
|
def response_message(parsed_response)
|
96
94
|
parsed_response[1]
|
97
|
-
rescue
|
95
|
+
rescue StandardError
|
98
96
|
nil
|
99
97
|
end
|
100
98
|
|
data/lib/pubnub/events/revoke.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
module Pubnub
|
3
3
|
# Holds revoke functionality
|
4
4
|
class Revoke < PAM
|
5
|
-
include
|
5
|
+
include Concurrent::Async
|
6
6
|
include Pubnub::Validator::Revoke
|
7
7
|
|
8
8
|
def initialize(options, app)
|
@@ -18,8 +18,8 @@ module Pubnub
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def parameters(signature = false)
|
21
|
-
write
|
22
|
-
read
|
21
|
+
write = [0, '0', false].include?(@write) ? 1 : 0
|
22
|
+
read = [0, '0', false].include?(@read) ? 1 : 0
|
23
23
|
manage = [0, '0', false].include?(@manage) ? 1 : 0 unless @group.blank?
|
24
24
|
|
25
25
|
{ timestamp: @timestamp,
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module Pubnub
|
3
3
|
# Holds SetState functionality
|
4
4
|
class SetState < SingleEvent
|
5
|
-
include
|
5
|
+
include Concurrent::Async
|
6
6
|
include Pubnub::Validator::SetState
|
7
7
|
|
8
8
|
def initialize(options, app)
|
@@ -20,8 +20,8 @@ module Pubnub
|
|
20
20
|
|
21
21
|
def parameters(*_args)
|
22
22
|
parameters = super
|
23
|
-
parameters
|
24
|
-
parameters
|
23
|
+
parameters[:state] = encode_parameter(@state)
|
24
|
+
parameters['channel-group'] = format_channel_group(@group).join(',') unless @group.blank?
|
25
25
|
parameters
|
26
26
|
end
|
27
27
|
|
data/lib/pubnub/events/state.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
module Pubnub
|
3
3
|
# Holds state functionality
|
4
4
|
class State < SingleEvent
|
5
|
-
include
|
5
|
+
include Concurrent::Async
|
6
6
|
include Pubnub::Validator::State
|
7
7
|
|
8
8
|
def initialize(options, app)
|
@@ -21,9 +21,7 @@ module Pubnub
|
|
21
21
|
|
22
22
|
def parameters(*_args)
|
23
23
|
parameters = super
|
24
|
-
parameters.
|
25
|
-
'channel-group' => @group.join(',')
|
26
|
-
) unless @group.blank?
|
24
|
+
parameters['channel-group'] = @group.join(',') unless @group.blank?
|
27
25
|
parameters
|
28
26
|
end
|
29
27
|
|
@@ -42,9 +40,9 @@ module Pubnub
|
|
42
40
|
|
43
41
|
def valid_envelope(parsed_response, req_res_objects)
|
44
42
|
Pubnub::Envelope.new(
|
45
|
-
event:
|
43
|
+
event: @event,
|
46
44
|
event_options: @given_options,
|
47
|
-
timetoken:
|
45
|
+
timetoken: nil,
|
48
46
|
status: {
|
49
47
|
code: req_res_objects[:response].code,
|
50
48
|
client_request: req_res_objects[:request],
|
@@ -3,7 +3,7 @@ module Pubnub
|
|
3
3
|
# Holds subscribe functionality, beware, most of subscribe functionality is
|
4
4
|
# held by SubscribeEvent
|
5
5
|
class Subscribe < SubscribeEvent
|
6
|
-
include
|
6
|
+
include Concurrent::Async
|
7
7
|
include Pubnub::Validator::Subscribe
|
8
8
|
|
9
9
|
def initialize(options, app)
|
data/lib/pubnub/events/time.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
module Pubnub
|
3
3
|
# Holds time functionality
|
4
4
|
class Time < SingleEvent
|
5
|
-
include
|
5
|
+
include Concurrent::Async
|
6
6
|
include Pubnub::Validator::Time
|
7
7
|
|
8
8
|
def initialize(options, app)
|
@@ -23,7 +23,7 @@ module Pubnub
|
|
23
23
|
|
24
24
|
def timetoken(parsed_response)
|
25
25
|
parsed_response.first
|
26
|
-
rescue
|
26
|
+
rescue StandardError
|
27
27
|
nil
|
28
28
|
end
|
29
29
|
|
@@ -2,15 +2,15 @@
|
|
2
2
|
module Pubnub
|
3
3
|
# Holds where_now functionality
|
4
4
|
class WhereNow < SingleEvent
|
5
|
-
include
|
5
|
+
include Concurrent::Async
|
6
6
|
include Pubnub::Validator::WhereNow
|
7
7
|
|
8
8
|
def initialize(options, app)
|
9
9
|
super
|
10
|
-
@telemetry_name
|
10
|
+
@telemetry_name = :l_pres
|
11
11
|
@uuid_looking_for = options[:uuid] || options['uuid']
|
12
|
-
@uuid
|
13
|
-
@event
|
12
|
+
@uuid = app.uuid
|
13
|
+
@event = :where_now
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
@@ -32,9 +32,9 @@ module Pubnub
|
|
32
32
|
|
33
33
|
def valid_envelope(parsed_response, req_res_objects)
|
34
34
|
Pubnub::Envelope.new(
|
35
|
-
event:
|
35
|
+
event: @event,
|
36
36
|
event_options: @given_options,
|
37
|
-
timetoken:
|
37
|
+
timetoken: nil,
|
38
38
|
status: {
|
39
39
|
code: req_res_objects[:response].code,
|
40
40
|
client_request: req_res_objects[:request],
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Toplevel Pubnub module.
|
2
|
+
module Pubnub
|
3
|
+
input_paths = if ARGV.empty?
|
4
|
+
Dir.glob("#{File.dirname(__FILE__)}/*.in.rb")
|
5
|
+
else
|
6
|
+
ARGV
|
7
|
+
end.map { |p| File.expand_path p }
|
8
|
+
|
9
|
+
input_paths.each_with_index do |input_path, _i|
|
10
|
+
pid = fork do
|
11
|
+
require_relative 'init.rb'
|
12
|
+
|
13
|
+
begin
|
14
|
+
output_path = input_path.gsub /\.in\.rb$/, '.out.rb'
|
15
|
+
input = File.readlines(input_path)
|
16
|
+
|
17
|
+
chunks = []
|
18
|
+
line = ''
|
19
|
+
|
20
|
+
until input.empty?
|
21
|
+
line += input.shift
|
22
|
+
if Pry::Code.complete_expression? line
|
23
|
+
chunks << line
|
24
|
+
line = ''
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
raise unless line.empty?
|
29
|
+
|
30
|
+
chunks.map! { |chunk| [chunk, [chunk.split($INPUT_RECORD_SEPARATOR).size, 1].max] }
|
31
|
+
environment = Module.new.send :binding
|
32
|
+
evaluate = lambda do |code, line|
|
33
|
+
p 'eval'
|
34
|
+
eval(code, environment, input_path, line)
|
35
|
+
end
|
36
|
+
|
37
|
+
indent = 50
|
38
|
+
|
39
|
+
line_count = 1
|
40
|
+
output = ''
|
41
|
+
chunks.each do |chunk, lines|
|
42
|
+
result = evaluate.call(chunk, line_count)
|
43
|
+
if chunk.strip.empty? || chunk =~ /\A *#/
|
44
|
+
output << chunk
|
45
|
+
else
|
46
|
+
pre_lines = chunk.lines.to_a
|
47
|
+
last_line = pre_lines.pop
|
48
|
+
output << pre_lines.join
|
49
|
+
|
50
|
+
if last_line =~ /\#$/
|
51
|
+
output << last_line.gsub(/\#$/, '')
|
52
|
+
else
|
53
|
+
if last_line.size < indent && result.inspect.size < indent
|
54
|
+
output << format("%-#{indent}s %s", last_line.chomp, "# => #{result.inspect}\n")
|
55
|
+
else
|
56
|
+
output << last_line << " # => #{result.inspect}\n"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
line_count += lines
|
61
|
+
end
|
62
|
+
|
63
|
+
puts "#{input_path}\n -> #{output_path}"
|
64
|
+
# puts output
|
65
|
+
File.write(output_path, output)
|
66
|
+
rescue StandardError => ex
|
67
|
+
puts "#{ex} (#{ex.class})\n#{ex.backtrace * "\n"}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
Process.wait pid
|
72
|
+
end
|
73
|
+
end
|
data/lib/pubnub/formatter.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
1
3
|
# Toplevel Pubnub module.
|
2
4
|
module Pubnub
|
3
5
|
# Bunch of useful methods that are used in many parts of Pubnub and and can be
|
@@ -32,19 +34,14 @@ module Pubnub
|
|
32
34
|
def format_message(message, cipher_key, uri_escape = true)
|
33
35
|
if cipher_key
|
34
36
|
pc = Pubnub::Crypto.new(cipher_key)
|
35
|
-
message = pc.encrypt(message)
|
36
|
-
|
37
|
-
|
38
|
-
else
|
39
|
-
message.to_json
|
40
|
-
end
|
37
|
+
message = pc.encrypt(message).to_json
|
38
|
+
# rubocop:disable Lint/UriEscapeUnescape
|
39
|
+
message = URI.escape(message) if uri_escape
|
41
40
|
else
|
42
|
-
|
43
|
-
|
44
|
-
else
|
45
|
-
message.to_json
|
46
|
-
end
|
41
|
+
message = message.to_json
|
42
|
+
message = Formatter.encode(message) if uri_escape
|
47
43
|
end
|
44
|
+
message
|
48
45
|
end
|
49
46
|
|
50
47
|
# Quite lazy way, but good enough for current usage
|
@@ -58,13 +55,18 @@ module Pubnub
|
|
58
55
|
|
59
56
|
def make_channel_array(channel)
|
60
57
|
case channel.class.to_s
|
61
|
-
when 'String'
|
62
|
-
|
63
|
-
when '
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
58
|
+
when 'String'
|
59
|
+
channel.to_s.split(',')
|
60
|
+
when 'Symbol'
|
61
|
+
channel.to_s.split(',')
|
62
|
+
when 'Array'
|
63
|
+
channel.map(&:to_s)
|
64
|
+
when 'NilClass'
|
65
|
+
[]
|
66
|
+
else
|
67
|
+
raise Pubnub::ArgumentError.new(
|
68
|
+
message: 'Channel has to be String, Symbol or Array'
|
69
|
+
), 'Channel has to be String, Symbol or Array'
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
@@ -79,10 +81,10 @@ module Pubnub
|
|
79
81
|
def params_hash_to_url_params(hash)
|
80
82
|
params = ''
|
81
83
|
hash.sort_by { |k, _v| k.to_s }.to_h.each do |key, value|
|
82
|
-
if %w
|
84
|
+
if %w[meta ortt].include?(key.to_s)
|
83
85
|
encoded_value = URI.encode_www_form_component(value.to_json).gsub('+', '%20')
|
84
86
|
params << "#{key}=#{encoded_value}&"
|
85
|
-
elsif %w
|
87
|
+
elsif %w[t state filter-expr].include?(key.to_s)
|
86
88
|
params << "#{key}=#{value}&"
|
87
89
|
else
|
88
90
|
params << "#{key}=#{URI.encode_www_form_component(value).gsub('+', '%20')}&"
|
@@ -93,7 +95,7 @@ module Pubnub
|
|
93
95
|
|
94
96
|
# Returns string with all channels separated by comma or single coma
|
95
97
|
def channels_for_url(channels, should_encode = true)
|
96
|
-
channel = channels.map{ |c| should_encode ? encode(c) : c }.sort.join(',')
|
98
|
+
channel = channels.map { |c| should_encode ? encode(c) : c }.sort.join(',')
|
97
99
|
channel = ',' if channel.empty?
|
98
100
|
channel
|
99
101
|
end
|
data/lib/pubnub/heart.rb
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
module Pubnub
|
3
3
|
# Heart takes responsibility of heartbeat event
|
4
4
|
class Heart
|
5
|
-
include
|
5
|
+
include Concurrent::Async
|
6
6
|
|
7
7
|
def initialize(options)
|
8
8
|
@heartbeat = options[:heartbeat]
|
9
|
-
@channel
|
10
|
-
@app
|
9
|
+
@channel = options[:channel]
|
10
|
+
@app = options[:app]
|
11
11
|
end
|
12
12
|
|
13
13
|
def start_beating
|
@@ -25,7 +25,7 @@ module Pubnub
|
|
25
25
|
|
26
26
|
def beat
|
27
27
|
@app.heartbeat(
|
28
|
-
channel:
|
28
|
+
channel: @channel,
|
29
29
|
heartbeat: @heartbeat,
|
30
30
|
http_sync: true
|
31
31
|
)
|
@@ -43,7 +43,7 @@ module Pubnub
|
|
43
43
|
response_valid? get_ping_response(uri)
|
44
44
|
rescue Errno::ECONNREFUSED
|
45
45
|
false
|
46
|
-
rescue => e
|
46
|
+
rescue StandardError => e
|
47
47
|
Pubnub.logger.error('Pubnub::OriginManager') do
|
48
48
|
"#{e.inspect} #{e.backtrace}"
|
49
49
|
end
|
@@ -71,10 +71,8 @@ module Pubnub
|
|
71
71
|
alive_and_valid?(@http)
|
72
72
|
end
|
73
73
|
|
74
|
-
def bring_down(_origin)
|
75
|
-
end
|
74
|
+
def bring_down(_origin); end
|
76
75
|
|
77
|
-
def bring_up(_origin)
|
78
|
-
end
|
76
|
+
def bring_up(_origin); end
|
79
77
|
end
|
80
78
|
end
|
data/lib/pubnub/pam.rb
CHANGED
@@ -18,7 +18,7 @@ module Pubnub
|
|
18
18
|
@subscribe_key,
|
19
19
|
@publish_key,
|
20
20
|
@event,
|
21
|
-
variables_for_signature.gsub(/[!~'()*]/) { |char| '%' + char.ord.to_s(16).upcase } # Replace ! ~ * ' ( )
|
21
|
+
variables_for_signature.gsub(/[!~'()*]/) { |char| '%' + char.ord.to_s(16).upcase }, # Replace ! ~ * ' ( )
|
22
22
|
].join("\n")
|
23
23
|
|
24
24
|
Base64.urlsafe_encode64(
|
@@ -29,10 +29,10 @@ module Pubnub
|
|
29
29
|
|
30
30
|
def parameters(set_signature = false)
|
31
31
|
params = super()
|
32
|
-
params
|
33
|
-
params
|
34
|
-
params
|
35
|
-
params
|
32
|
+
params['channel-group'] = @group.join(',') unless @group.blank?
|
33
|
+
params[:timestamp] = @timestamp
|
34
|
+
params[:channel] = @channel.join(',') unless @channel.first.blank?
|
35
|
+
params[:signature] = signature unless set_signature
|
36
36
|
params
|
37
37
|
end
|
38
38
|
|