sse-client 1.0.1 → 1.1.0
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/lib/sse-client.rb +5 -3
- 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: 14ee18e06a5a559bfb3390a4857e4c13c6976917
|
4
|
+
data.tar.gz: 2f95cad910f0c201a18e74f1bb61e4e05e958aaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9109313148f63ee6593c89d550a7b48f5cd06c3d177a6236eca4087a3a1f84cfb076590276680b517b002700d8c8993d6ffc9fc5df74ab26337b8daeaae8f5c
|
7
|
+
data.tar.gz: 10229991e03a9c15ebe6086d540b2d0444e2542f0a7da4092a919658135ad767ade27b0ddb153498767aa4e1315c2c6a4402db9f956489d03e845d9540ede60b
|
data/lib/sse-client.rb
CHANGED
@@ -16,11 +16,12 @@ module SSE
|
|
16
16
|
# The connection is not open, and the user agent is not trying to reconnect. Either there was a fatal error or the close() method was invoked.
|
17
17
|
CLOSED = 2
|
18
18
|
|
19
|
-
def initialize(url
|
19
|
+
def initialize(url, query = {}, headers = {}, before_execution_proc: nil)
|
20
20
|
@url = url
|
21
21
|
@headers = headers
|
22
22
|
@headers['params'] = query
|
23
23
|
@ready_state = CLOSED
|
24
|
+
@before_execution_proc = before_execution_proc
|
24
25
|
|
25
26
|
@opens = []
|
26
27
|
@errors = []
|
@@ -67,13 +68,14 @@ module SSE
|
|
67
68
|
end
|
68
69
|
close
|
69
70
|
else
|
70
|
-
handle_error response
|
71
|
+
handle_error response
|
71
72
|
end
|
72
73
|
}
|
73
74
|
conn = RestClient::Request.execute(method: :get,
|
74
75
|
url: @url,
|
75
76
|
headers: @headers,
|
76
|
-
block_response: block
|
77
|
+
block_response: block,
|
78
|
+
before_execution_proc: @before_execution_proc)
|
77
79
|
end
|
78
80
|
|
79
81
|
def handle_stream(stream)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sse-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- oplinjie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|