ld-celluloid-eventsource 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/celluloid/eventsource/version.rb +1 -1
- data/lib/celluloid/eventsource.rb +13 -7
- 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: 436ffbb975c4f324a9f3589984e6bc9344884319
|
4
|
+
data.tar.gz: 4396b0535c22dadff98bc1760642318157630451
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22c0dc786d05848a98ec0633c9c866a0d1375c33314c6b55664fac478e88f1c49bf8de53d5611f8ec17a0477b4f60aa2216b98b8085859ca0b48be547b5855d2
|
7
|
+
data.tar.gz: b1de7d025ded3b794ad2a866dce4362b82b631708b0ddfa06c27ea48950973fdb02ab7fc4d64f2928cda4941f8e800a56ede50f54963c315893b6a63d073c372
|
@@ -30,7 +30,7 @@ module Celluloid
|
|
30
30
|
|
31
31
|
@last_event_id = String.new
|
32
32
|
|
33
|
-
@reconnect_timeout =
|
33
|
+
@reconnect_timeout = 1
|
34
34
|
@on = { open: ->{}, message: ->(_) {}, error: ->(_) {} }
|
35
35
|
@parser = ResponseParser.new
|
36
36
|
|
@@ -54,11 +54,15 @@ module Celluloid
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def listen
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
while !closed?
|
58
|
+
begin
|
59
|
+
establish_connection
|
60
|
+
chunked? ? process_chunked_stream : process_stream
|
61
|
+
rescue
|
62
|
+
# Just reconnect
|
63
|
+
end
|
64
|
+
sleep @reconnect_timeout
|
65
|
+
end
|
62
66
|
end
|
63
67
|
|
64
68
|
def close
|
@@ -108,7 +112,9 @@ module Celluloid
|
|
108
112
|
until @socket.eof?
|
109
113
|
@parser << @socket.readline
|
110
114
|
end
|
111
|
-
close
|
115
|
+
# If the server returns a non-200, we don't want to close-- we just want to
|
116
|
+
# report an error
|
117
|
+
# close
|
112
118
|
@on[:error].call({status_code: @parser.status_code, body: @parser.chunk})
|
113
119
|
return
|
114
120
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ld-celluloid-eventsource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leo Correa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid-io
|