colossus 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/colossus/version.rb +1 -1
- data/lib/colossus/writer_client.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52b3f1a89293f737131d8e42ce08efd70c017ed3
|
4
|
+
data.tar.gz: 5a518a4a5b55b4bfa1d767fd61856eb76569e846
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3607a0fd65690fd85e26dc17d14b6ec048e0e0fa58f67d728d1c1ac33e3fa7076f41ff90a1348437e0383cccb2ca671263f76d0fb27dbfa2171ddebade938646
|
7
|
+
data.tar.gz: 46f6905bf49524fbd87c7680e7db010a28e84fd52b1208a1745f30bd2c2646f98ccdfd688435c3f8df56f498880c182953f062de3f84afb8d468252826f790a7
|
data/lib/colossus/version.rb
CHANGED
@@ -14,7 +14,7 @@ class Colossus
|
|
14
14
|
user_ids = Array(optional_user_ids) if optional_user_ids
|
15
15
|
unique_token = generate_unique_token
|
16
16
|
EM.synchrony do
|
17
|
-
EM::Synchrony.add_timer(time_out) { raise
|
17
|
+
EM::Synchrony.add_timer(time_out) { raise 'Presence request timed out' }
|
18
18
|
EM::Synchrony.sync(faye_client.subscribe("/presences/response/#{unique_token}") { |message| return message['statuses'] })
|
19
19
|
EM::Synchrony.sync(faye_client.publish("/presences/request/#{unique_token}", user_ids))
|
20
20
|
end
|
@@ -24,7 +24,7 @@ class Colossus
|
|
24
24
|
user_ids = Array(optional_user_ids) if optional_user_ids
|
25
25
|
# Custom Content-Type to indicate to the server
|
26
26
|
# this is a simple http request
|
27
|
-
conn
|
27
|
+
conn = Faraday.new(url, headers: {'Content-Type' => 'application/vnd.http.json'}) do |conf|
|
28
28
|
conf.adapter Faraday.default_adapter
|
29
29
|
conf.response :raise_error
|
30
30
|
end
|
@@ -40,6 +40,7 @@ class Colossus
|
|
40
40
|
def push_message(user_ids, message)
|
41
41
|
user_ids = Array(user_ids)
|
42
42
|
EM.synchrony do
|
43
|
+
EM::Synchrony.add_timer(time_out) { raise 'Push message timed out' }
|
43
44
|
user_ids.each do |user_id|
|
44
45
|
EM::Synchrony.sync(faye_client.publish("/users/#{user_id}", message))
|
45
46
|
end
|
@@ -50,7 +51,7 @@ class Colossus
|
|
50
51
|
private
|
51
52
|
|
52
53
|
def faye_client
|
53
|
-
faye_client
|
54
|
+
faye_client = ::Faye::Client.new(url)
|
54
55
|
faye_client.add_extension(FayeExtension.new(writer_token))
|
55
56
|
faye_client
|
56
57
|
end
|