slack-ruby-client 0.14.3 → 0.14.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +5 -3
- data/lib/slack/real_time/client.rb +5 -1
- data/lib/slack/real_time/concurrency/async.rb +1 -1
- data/lib/slack/real_time/concurrency/celluloid.rb +1 -1
- data/lib/slack/real_time/concurrency/eventmachine.rb +1 -1
- data/lib/slack/version.rb +1 -1
- data/spec/integration/integration_spec.rb +10 -6
- data/spec/slack/real_time/client_spec.rb +23 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf802522f0f9aa42f83506227b02fcf37beb861429316f9ae2155d3eedde79d8
|
4
|
+
data.tar.gz: 5a81c7017616999820506cdff2af962ecbb601931f04da9598bdc9767307769b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e648e70aed991cba05dce9cc9907771d8b13c69ecab9386093460d8d3547e0fc825393d174dee7bddf1fcef15b8f85b496ae9a24cadacc4a7054db775508527a
|
7
|
+
data.tar.gz: e8397379744685f4880c20afdadaf9c19439ea9f4cb0c362e596849416f67f836686626f65af81e5ce933c2eeb9c33117fcb8f64bb6967be4963f6a477f61910
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
### 0.14.4 (2019/7/28)
|
2
|
+
|
3
|
+
* [#289](https://github.com/slack-ruby/slack-ruby-client/pull/289): Fix reconnects when ping timers under/overshoot - [@georgyangelov](https://github.com/georgyangelov).
|
4
|
+
* [#290](https://github.com/slack-ruby/slack-ruby-client/pull/290): Expose Slack::RealTime::Client.logger accessor publicly - [@jcraigk](https://github.com/jcraigk).
|
5
|
+
|
1
6
|
### 0.14.3 (2019/7/23)
|
2
7
|
|
3
8
|
* [#279](https://github.com/slack-ruby/slack-ruby-client/pull/279): Prevent ping worker from dying on unexpected errors - [@dblock](https://github.com/dblock).
|
data/README.md
CHANGED
@@ -66,7 +66,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web), [RealTime Messagin
|
|
66
66
|
|
67
67
|
## Stable Release
|
68
68
|
|
69
|
-
You're reading the documentation for the **stable** release of slack-ruby-client, 0.14.
|
69
|
+
You're reading the documentation for the **stable** release of slack-ruby-client, 0.14.4. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
|
70
70
|
|
71
71
|
## Installation
|
72
72
|
|
@@ -374,9 +374,11 @@ See a fully working example in [examples/hi_real_time](examples/hi_real_time/hi.
|
|
374
374
|
##### `websocket_ping`
|
375
375
|
This setting determines how long the socket can be idle before sending a ping message to confirm it's still connected.
|
376
376
|
|
377
|
-
It's important to note that if a ping message was sent and no response was received within the amount of time specified in `websocket_ping
|
377
|
+
It's important to note that if a ping message was sent and no response was received within the amount of time specified in `websocket_ping` the client will attempt to reestablish it's connection to the message server.
|
378
378
|
|
379
|
-
|
379
|
+
Note that the ping may take between `websocket_ping` and `websocket_ping * 3/2` seconds to actually trigger when there is no activity on the socket. This is because the timer that checks whether to ping is triggered at every `websocket_ping / 2` interval.
|
380
|
+
|
381
|
+
To disable this feature set `websocket_ping` to 0.
|
380
382
|
|
381
383
|
### Connection Methods
|
382
384
|
|
@@ -19,8 +19,8 @@ module Slack
|
|
19
19
|
attr_accessor :store
|
20
20
|
attr_accessor :url
|
21
21
|
attr_accessor(*Config::ATTRIBUTES)
|
22
|
+
attr_accessor :logger
|
22
23
|
|
23
|
-
protected :logger, :logger=
|
24
24
|
protected :store_class, :store_class=
|
25
25
|
|
26
26
|
def initialize(options = {})
|
@@ -139,6 +139,10 @@ module Slack
|
|
139
139
|
!websocket_ping.nil? && websocket_ping > 0
|
140
140
|
end
|
141
141
|
|
142
|
+
def websocket_ping_timer
|
143
|
+
websocket_ping / 2
|
144
|
+
end
|
145
|
+
|
142
146
|
def to_s
|
143
147
|
if store && store.team
|
144
148
|
"id=#{store.team.id}, name=#{store.team.name}, domain=#{store.team.domain}"
|
data/lib/slack/version.rb
CHANGED
@@ -123,7 +123,7 @@ RSpec.describe 'integration test', skip: (!ENV['SLACK_API_TOKEN'] || !ENV['CONCU
|
|
123
123
|
|
124
124
|
context 'with websocket_ping set' do
|
125
125
|
before do
|
126
|
-
client.websocket_ping =
|
126
|
+
client.websocket_ping = 5
|
127
127
|
end
|
128
128
|
|
129
129
|
it 'sends pings' do
|
@@ -136,18 +136,20 @@ RSpec.describe 'integration test', skip: (!ENV['SLACK_API_TOKEN'] || !ENV['CONCU
|
|
136
136
|
|
137
137
|
start_server
|
138
138
|
|
139
|
-
queue.pop_with_timeout(
|
140
|
-
expect(@reply_to).to
|
139
|
+
queue.pop_with_timeout(10)
|
140
|
+
expect(@reply_to).to eq 1
|
141
141
|
end
|
142
142
|
|
143
143
|
it 'rebuilds the websocket connection when dropped' do
|
144
144
|
@reply_to = nil
|
145
145
|
client.on :pong do |data|
|
146
|
+
logger.info data
|
146
147
|
@reply_to = data.reply_to
|
147
148
|
if @reply_to == 1
|
148
149
|
client.instance_variable_get(:@socket).close
|
150
|
+
queue.push :close
|
149
151
|
else
|
150
|
-
expect(@reply_to).to
|
152
|
+
expect(@reply_to).to eq 2
|
151
153
|
queue.push :pong
|
152
154
|
client.stop!
|
153
155
|
end
|
@@ -155,8 +157,10 @@ RSpec.describe 'integration test', skip: (!ENV['SLACK_API_TOKEN'] || !ENV['CONCU
|
|
155
157
|
|
156
158
|
start_server
|
157
159
|
|
158
|
-
|
159
|
-
|
160
|
+
4.times do |i|
|
161
|
+
queue.pop_with_timeout(10)
|
162
|
+
client.logger.info "Pop #{i}"
|
163
|
+
end
|
160
164
|
end
|
161
165
|
end
|
162
166
|
|
@@ -42,6 +42,20 @@ RSpec.describe Slack::RealTime::Client do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
45
|
+
context 'websocket_ping_timer' do
|
46
|
+
context 'with defaults' do
|
47
|
+
let(:client) { Slack::RealTime::Client.new }
|
48
|
+
it 'defaults to websocket_ping / 2' do
|
49
|
+
expect(client.websocket_ping_timer).to eq 15
|
50
|
+
end
|
51
|
+
end
|
52
|
+
context 'with websocket_ping value changed' do
|
53
|
+
let(:client) { Slack::RealTime::Client.new(websocket_ping: 22) }
|
54
|
+
it 'defaults to websocket_ping / 2' do
|
55
|
+
expect(client.websocket_ping_timer).to eq 11
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
45
59
|
context 'client with a full store', vcr: { cassette_name: 'web/rtm_start', allow_playback_repeats: true } do
|
46
60
|
let(:client) { Slack::RealTime::Client.new(store_class: Slack::RealTime::Stores::Store) }
|
47
61
|
let(:url) { 'wss://ms173.slack-msgs.com/websocket/lqcUiAvrKTP-uuid=' }
|
@@ -314,6 +328,15 @@ RSpec.describe Slack::RealTime::Client do
|
|
314
328
|
end
|
315
329
|
end
|
316
330
|
end
|
331
|
+
describe 'logger accessor' do
|
332
|
+
let(:client) { Slack::RealTime::Client.new }
|
333
|
+
it 'exposes public logger' do
|
334
|
+
expect(client.logger).to be_a(::Logger)
|
335
|
+
end
|
336
|
+
it 'exposes public logger=' do
|
337
|
+
expect { client.logger = nil }.not_to raise_error(NoMethodError)
|
338
|
+
end
|
339
|
+
end
|
317
340
|
end
|
318
341
|
context 'global config' do
|
319
342
|
after do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|