async-slack 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/async/slack/real_time.rb +23 -1
- data/lib/async/slack/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3fca86c14e3ed76970f56c65c20e204875ad6ced23aa3f95830b76b6e4e978c
|
4
|
+
data.tar.gz: f4d59d3289a976bfb12e10c9f5453f6dd24de63c8b54cc2dbb4454692205473e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b0d890ae747f3db3397a0b5eca3de4f6689fa2ef87e276af6d82f97dcb53ab9f8c07aa07b2f935a7a371ed8b36bbee6ea3a3b7ae9573fbfecc8c42ffedc97f8
|
7
|
+
data.tar.gz: 6459df53d55475e970a22f2ddb90d5fc6b191bca2bfd3c9bb0f522470814335b0ab7e4d41d736f0870dcdf31db5f716a0591d8db4e486668a49b1a90e9df627c
|
@@ -36,7 +36,29 @@ module Async
|
|
36
36
|
|
37
37
|
endpoint = Async::HTTP::Endpoint.parse(url)
|
38
38
|
|
39
|
-
Async::WebSocket::Client.connect(endpoint, **options
|
39
|
+
Async::WebSocket::Client.connect(endpoint, **options) do |connection|
|
40
|
+
self.start(connection, &block)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def start(connection, &block)
|
45
|
+
id = 1
|
46
|
+
|
47
|
+
pinger = Async do |task|
|
48
|
+
while true
|
49
|
+
task.sleep 2
|
50
|
+
|
51
|
+
Async.logger.debug(self) {"Sending ping #{id}..."}
|
52
|
+
connection.write({type: "ping", id: "pinger-#{id}"})
|
53
|
+
connection.flush
|
54
|
+
|
55
|
+
id += 1
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
yield connection
|
60
|
+
ensure
|
61
|
+
pinger.stop
|
40
62
|
end
|
41
63
|
end
|
42
64
|
end
|
data/lib/async/slack/version.rb
CHANGED