lightstreamer 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/lightstreamer.rb +1 -1
- data/lib/lightstreamer/control_connection.rb +5 -4
- data/lib/lightstreamer/errors.rb +154 -174
- data/lib/lightstreamer/session.rb +1 -1
- data/lib/lightstreamer/stream_connection.rb +18 -20
- data/lib/lightstreamer/stream_connection_header.rb +4 -4
- data/lib/lightstreamer/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c5dce2a119bf535faac9e10b36a13624cf57038
|
4
|
+
data.tar.gz: 64bd43f2f8e122608e552e23dfa38047a0e3b53f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3261d66e3032ff0f0d324b02e7efda9626fd9a207921247307cbc6d0cbb97698131d423185012ae1b1741af1c50e867a886b4ed5fe30d1093bc6e9c7ec85a7b5
|
7
|
+
data.tar.gz: a8ad81e667183f8d867162f0d0f2733ec7c9d15541508f22b94c34638f944d9343b9cea862bf0f7407475a141f487d281c45bff04644eed37c1c02990b8bd75a
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
# Lightstreamer Changelog
|
2
2
|
|
3
|
+
### 0.6 — July 26, 2016
|
4
|
+
|
5
|
+
- Switched to the `excon` HTTP library
|
6
|
+
- Moved all subclasses of `Lightstreamer::LightstreamerError` into the `Lightstreamer::Errors` module
|
7
|
+
- Replaced `Lightstreamer::Errors::RequestError` with `Lightstreamer::Errors::ConnectionError`
|
8
|
+
|
3
9
|
### 0.5 — July 26, 2016
|
4
10
|
|
5
11
|
- Improved handling of `:distinct` subscriptions
|
6
12
|
- Subscriptions can now request an unfiltered stream and handle any overflow messages from the server using
|
7
|
-
`Lightstreamer::Subscription#
|
13
|
+
`Lightstreamer::Subscription#on_overflow`
|
8
14
|
- Added a connection timeout to all requests
|
9
15
|
- Unhandled exceptions in subscription data callbacks are no longer automatically rescued
|
10
16
|
- Improved API documentation
|
data/lib/lightstreamer.rb
CHANGED
@@ -21,6 +21,7 @@ module Lightstreamer
|
|
21
21
|
def execute(operation, options = {})
|
22
22
|
result = execute_post_request build_payload(operation, options)
|
23
23
|
|
24
|
+
raise Errors::SyncError if result.first == 'SYNC ERROR'
|
24
25
|
raise LightstreamerError.build(result[2], result[1]) if result.first != 'OK'
|
25
26
|
end
|
26
27
|
|
@@ -55,14 +56,14 @@ module Lightstreamer
|
|
55
56
|
raise ArgumentError, 'Unsupported mode' unless [:distinct, :merge].include? options[:mode]
|
56
57
|
end
|
57
58
|
|
58
|
-
# Executes a POST request to the control address with the specified payload. Raises {
|
59
|
+
# Executes a POST request to the control address with the specified payload. Raises {ConnectionError} if the HTTP
|
59
60
|
# request fails. Returns the response body split into individual lines.
|
60
61
|
def execute_post_request(payload)
|
61
|
-
response =
|
62
|
-
|
63
|
-
raise RequestError.new(response.return_message, response.response_code) unless response.success?
|
62
|
+
response = Excon.post @control_url, body: URI.encode_www_form(payload), connect_timeout: 15
|
64
63
|
|
65
64
|
response.body.split("\n").map(&:strip)
|
65
|
+
rescue Excon::Error => error
|
66
|
+
raise Errors::ConnectionError, error.message
|
66
67
|
end
|
67
68
|
|
68
69
|
# Constructs the payload for a Lightstreamer control request based on the given options hash. See {#execute} for
|
data/lib/lightstreamer/errors.rb
CHANGED
@@ -2,183 +2,163 @@ module Lightstreamer
|
|
2
2
|
class LightstreamerError < StandardError
|
3
3
|
end
|
4
4
|
|
5
|
-
# This
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
class UnknownAdapterSetError < LightstreamerError
|
11
|
-
end
|
12
|
-
|
13
|
-
# This error is raise when trying to bind to a session that was initialized with a different and incompatible
|
14
|
-
# communication protocol.
|
15
|
-
class IncompatibleSessionError < LightstreamerError
|
16
|
-
end
|
17
|
-
|
18
|
-
# This error is raised when the licensed maximum number of sessions is reached.
|
19
|
-
class LicensedMaximumSessionsReachedError < LightstreamerError
|
20
|
-
end
|
21
|
-
|
22
|
-
# This error is raised when the configured maximum number of sessions is reached.
|
23
|
-
class ConfiguredMaximumSessionsReachedError < LightstreamerError
|
24
|
-
end
|
25
|
-
|
26
|
-
# This error is raised when the configured maximum server load is reached.
|
27
|
-
class ConfiguredMaximumServerLoadReachedError < LightstreamerError
|
28
|
-
end
|
5
|
+
# This module contains all the error classes for this gem. They all subclass {LightstreamerError}.
|
6
|
+
module Errors
|
7
|
+
# This error is raised when the session username and password check fails.
|
8
|
+
class AuthenticationError < LightstreamerError
|
9
|
+
end
|
29
10
|
|
30
|
-
|
31
|
-
|
32
|
-
|
11
|
+
# This error is raised when the requested adapter set is unknown.
|
12
|
+
class UnknownAdapterSetError < LightstreamerError
|
13
|
+
end
|
33
14
|
|
34
|
-
|
35
|
-
|
36
|
-
|
15
|
+
# This error is raised when trying to bind to a session that was initialized with a different and incompatible
|
16
|
+
# communication protocol.
|
17
|
+
class IncompatibleSessionError < LightstreamerError
|
18
|
+
end
|
37
19
|
|
38
|
-
|
39
|
-
|
40
|
-
|
20
|
+
# This error is raised when the licensed maximum number of sessions is reached.
|
21
|
+
class LicensedMaximumSessionsReachedError < LightstreamerError
|
22
|
+
end
|
41
23
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
24
|
+
# This error is raised when the configured maximum number of sessions is reached.
|
25
|
+
class ConfiguredMaximumSessionsReachedError < LightstreamerError
|
26
|
+
end
|
46
27
|
|
47
|
-
|
48
|
-
|
49
|
-
|
28
|
+
# This error is raised when the configured maximum server load is reached.
|
29
|
+
class ConfiguredMaximumServerLoadReachedError < LightstreamerError
|
30
|
+
end
|
50
31
|
|
51
|
-
|
52
|
-
|
53
|
-
|
32
|
+
# This error is raised when the creation of new sessions has been temporarily blocked.
|
33
|
+
class NewSessionsTemporarilyBlockedError < LightstreamerError
|
34
|
+
end
|
54
35
|
|
55
|
-
|
56
|
-
|
57
|
-
|
36
|
+
# This error is raised when streaming is not available because of the current license terms.
|
37
|
+
class StreamingNotAvailableError < LightstreamerError
|
38
|
+
end
|
58
39
|
|
59
|
-
|
60
|
-
|
61
|
-
|
40
|
+
# This error is raised when the specified table can't be modified because it is configured for unfiltered
|
41
|
+
# dispatching.
|
42
|
+
class TableModificationNotAllowedError < LightstreamerError
|
43
|
+
end
|
62
44
|
|
63
|
-
|
64
|
-
|
65
|
-
|
45
|
+
# This error is raised when the specified data adapter is invalid or the data adapter is not specified and there is
|
46
|
+
# no default data adapter.
|
47
|
+
class InvalidDataAdapterError < LightstreamerError
|
48
|
+
end
|
66
49
|
|
67
|
-
|
68
|
-
|
69
|
-
|
50
|
+
# This error occurs when the specified table is not found.
|
51
|
+
class UnknownTableError < LightstreamerError
|
52
|
+
end
|
70
53
|
|
71
|
-
|
72
|
-
|
73
|
-
|
54
|
+
# This error is raised when an invalid item name is specified.
|
55
|
+
class InvalidItemError < LightstreamerError
|
56
|
+
end
|
74
57
|
|
75
|
-
|
76
|
-
|
77
|
-
|
58
|
+
# This error is raised when an invalid item name for the given fields is specified.
|
59
|
+
class InvalidItemForFieldsError < LightstreamerError
|
60
|
+
end
|
78
61
|
|
79
|
-
|
80
|
-
|
81
|
-
|
62
|
+
# This error is raised when an invalid field name is specified.
|
63
|
+
class InvalidFieldError < LightstreamerError
|
64
|
+
end
|
82
65
|
|
83
|
-
|
84
|
-
|
85
|
-
|
66
|
+
# This error is raised when the specified subscription mode is not supported by one of the items.
|
67
|
+
class UnsupportedModeForItemError < LightstreamerError
|
68
|
+
end
|
86
69
|
|
87
|
-
|
88
|
-
|
89
|
-
|
70
|
+
# This error is raised when an invalid selector is specified.
|
71
|
+
class InvalidSelectorError < LightstreamerError
|
72
|
+
end
|
90
73
|
|
91
|
-
|
92
|
-
|
93
|
-
|
74
|
+
# This error is raised when unfiltered dispatching is requested on an item that does not allow it.
|
75
|
+
class UnfilteredDispatchingNotAllowedForItemError < LightstreamerError
|
76
|
+
end
|
94
77
|
|
95
|
-
|
96
|
-
|
97
|
-
|
78
|
+
# This error is raised when unfiltered dispatching is requested on an item that does not support it.
|
79
|
+
class UnfilteredDispatchingNotSupportedForItemError < LightstreamerError
|
80
|
+
end
|
98
81
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
#
|
103
|
-
# @return [String]
|
104
|
-
attr_reader :adapter_error_message
|
82
|
+
# This error is raised when unfiltered dispatching is requested but is not allowed by the current license terms.
|
83
|
+
class UnfilteredDispatchingNotAllowedByLicenseError < LightstreamerError
|
84
|
+
end
|
105
85
|
|
106
|
-
#
|
107
|
-
|
108
|
-
|
109
|
-
attr_reader :adapter_error_code
|
86
|
+
# This error is raised when `RAW` mode was requested but is not allowed by the current license terms.
|
87
|
+
class RawModeNotAllowedByLicenseError < LightstreamerError
|
88
|
+
end
|
110
89
|
|
111
|
-
#
|
112
|
-
|
113
|
-
|
114
|
-
# @param [Fixnum] code The error code.
|
115
|
-
def initialize(message, code)
|
116
|
-
@adapter_error_message = message
|
117
|
-
@adapter_error_code = code
|
90
|
+
# This error is raised when subscriptions are not allowed by the current license terms.
|
91
|
+
class SubscriptionsNotAllowedByLicenseError < LightstreamerError
|
92
|
+
end
|
118
93
|
|
119
|
-
|
94
|
+
# This error is raised when the specified progressive sequence number for the custom message was invalid.
|
95
|
+
class InvalidProgressiveNumberError < LightstreamerError
|
120
96
|
end
|
121
|
-
end
|
122
97
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
end
|
98
|
+
# This error is raised when the client version requested is not supported by the server.
|
99
|
+
class ClientVersionNotSupportedError < LightstreamerError
|
100
|
+
end
|
127
101
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
102
|
+
# This error is raised when a error defined by a metadata adapter is raised.
|
103
|
+
class MetadataAdapterError < LightstreamerError
|
104
|
+
# The error message from the metadata adapter.
|
105
|
+
#
|
106
|
+
# @return [String]
|
107
|
+
attr_reader :adapter_error_message
|
108
|
+
|
109
|
+
# The error code from the metadata adapter.
|
110
|
+
#
|
111
|
+
# @return [Fixnum]
|
112
|
+
attr_reader :adapter_error_code
|
113
|
+
|
114
|
+
# Initializes this metadata adapter error with the specified error message and error code.
|
115
|
+
#
|
116
|
+
# @param [String] message The error message.
|
117
|
+
# @param [Fixnum] code The error code.
|
118
|
+
def initialize(message, code)
|
119
|
+
@adapter_error_message = message
|
120
|
+
@adapter_error_code = code
|
146
121
|
|
147
|
-
|
148
|
-
|
149
|
-
# @param [Session?] cause_code See {#cause_code} for details.
|
150
|
-
def initialize(cause_code)
|
151
|
-
@cause_code = cause_code && cause_code.to_i
|
152
|
-
super()
|
122
|
+
super message
|
123
|
+
end
|
153
124
|
end
|
154
|
-
end
|
155
125
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
# @return [String]
|
161
|
-
attr_reader :request_error_message
|
162
|
-
|
163
|
-
# The HTTP code that was returned, or zero if unknown.
|
164
|
-
#
|
165
|
-
# @return [Fixnum]
|
166
|
-
attr_reader :request_error_code
|
126
|
+
# This error is raised when a sync error occurs, which most often means that the session ID provided is invalid and
|
127
|
+
# a new session needs to be created.
|
128
|
+
class SyncError < LightstreamerError
|
129
|
+
end
|
167
130
|
|
168
|
-
#
|
169
|
-
#
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
131
|
+
# This error is raised when the session was explicitly closed on the server side. The reason for this is specified
|
132
|
+
# by {#cause_code}.
|
133
|
+
class SessionEndError < LightstreamerError
|
134
|
+
# The cause code specifying why the session was terminated by the server, or `nil` if unknown.
|
135
|
+
#
|
136
|
+
# The following codes are defined, but other values are allowed and signal an unexpected cause.
|
137
|
+
#
|
138
|
+
# - `<=0` - The session was closed through a `destroy` request and this custom code was specified.
|
139
|
+
# - `31` - The session was closed through a `destroy` request.
|
140
|
+
# - `32` - The session was closed by an administrator through JMX.
|
141
|
+
# - `33`, `34` - An unexpected error occurred on the server.
|
142
|
+
# - `35` - Another session was opened on the metadata adapter and the metadata adpater only supports one session.
|
143
|
+
# - `40` - A manual rebind to the session was done by another client.
|
144
|
+
# - `48` - The maximum session duration configured on the server has been reached. This is meant as a way to
|
145
|
+
# refresh the session and the client should recover by opening a new session immediately.
|
146
|
+
#
|
147
|
+
# @return [Fixnum, nil]
|
148
|
+
attr_reader :cause_code
|
149
|
+
|
150
|
+
# Initializes this session end error with the specified cause code.
|
151
|
+
#
|
152
|
+
# @param [Session?] cause_code See {#cause_code} for details.
|
153
|
+
def initialize(cause_code)
|
154
|
+
@cause_code = cause_code && cause_code.to_i
|
155
|
+
super()
|
180
156
|
end
|
181
157
|
end
|
158
|
+
|
159
|
+
# This error is raised when an HTTP connection error occurs.
|
160
|
+
class ConnectionError < LightstreamerError
|
161
|
+
end
|
182
162
|
end
|
183
163
|
|
184
164
|
# Base class for all errors raised by this gem.
|
@@ -190,46 +170,46 @@ module Lightstreamer
|
|
190
170
|
# @param [Fixnum] code The numeric error code that is used to determine which {LightstreamerError} subclass to
|
191
171
|
# instantiate.
|
192
172
|
#
|
193
|
-
# @return [
|
173
|
+
# @return [LightstreamerError]
|
194
174
|
#
|
195
175
|
# @private
|
196
176
|
def self.build(message, code)
|
197
177
|
code = code.to_i
|
198
178
|
|
199
179
|
if API_ERROR_CODE_TO_CLASS.key? code
|
200
|
-
API_ERROR_CODE_TO_CLASS[code].new
|
180
|
+
API_ERROR_CODE_TO_CLASS[code].new ''
|
201
181
|
elsif code <= 0
|
202
|
-
MetadataAdapterError.new message, code
|
182
|
+
Errors::MetadataAdapterError.new message, code
|
203
183
|
else
|
204
184
|
new "#{code}: #{message}"
|
205
185
|
end
|
206
186
|
end
|
207
187
|
|
208
188
|
API_ERROR_CODE_TO_CLASS = {
|
209
|
-
1 => AuthenticationError,
|
210
|
-
2 => UnknownAdapterSetError,
|
211
|
-
3 => IncompatibleSessionError,
|
212
|
-
7 => LicensedMaximumSessionsReachedError,
|
213
|
-
8 => ConfiguredMaximumSessionsReachedError,
|
214
|
-
9 => ConfiguredMaximumServerLoadReachedError,
|
215
|
-
10 => NewSessionsTemporarilyBlockedError,
|
216
|
-
11 => StreamingNotAvailableError,
|
217
|
-
13 => TableModificationNotAllowedError,
|
218
|
-
17 => InvalidDataAdapterError,
|
219
|
-
19 => UnknownTableError,
|
220
|
-
21 => InvalidItemError,
|
221
|
-
22 => InvalidItemForFieldsError,
|
222
|
-
23 => InvalidFieldError,
|
223
|
-
24 => UnsupportedModeForItemError,
|
224
|
-
25 => InvalidSelectorError,
|
225
|
-
26 => UnfilteredDispatchingNotAllowedForItemError,
|
226
|
-
27 => UnfilteredDispatchingNotSupportedForItemError,
|
227
|
-
28 => UnfilteredDispatchingNotAllowedByLicenseError,
|
228
|
-
29 => RawModeNotAllowedByLicenseError,
|
229
|
-
30 => SubscriptionsNotAllowedByLicenseError,
|
230
|
-
32 => InvalidProgressiveNumberError,
|
231
|
-
33 => InvalidProgressiveNumberError,
|
232
|
-
60 => ClientVersionNotSupportedError
|
189
|
+
1 => Errors::AuthenticationError,
|
190
|
+
2 => Errors::UnknownAdapterSetError,
|
191
|
+
3 => Errors::IncompatibleSessionError,
|
192
|
+
7 => Errors::LicensedMaximumSessionsReachedError,
|
193
|
+
8 => Errors::ConfiguredMaximumSessionsReachedError,
|
194
|
+
9 => Errors::ConfiguredMaximumServerLoadReachedError,
|
195
|
+
10 => Errors::NewSessionsTemporarilyBlockedError,
|
196
|
+
11 => Errors::StreamingNotAvailableError,
|
197
|
+
13 => Errors::TableModificationNotAllowedError,
|
198
|
+
17 => Errors::InvalidDataAdapterError,
|
199
|
+
19 => Errors::UnknownTableError,
|
200
|
+
21 => Errors::InvalidItemError,
|
201
|
+
22 => Errors::InvalidItemForFieldsError,
|
202
|
+
23 => Errors::InvalidFieldError,
|
203
|
+
24 => Errors::UnsupportedModeForItemError,
|
204
|
+
25 => Errors::InvalidSelectorError,
|
205
|
+
26 => Errors::UnfilteredDispatchingNotAllowedForItemError,
|
206
|
+
27 => Errors::UnfilteredDispatchingNotSupportedForItemError,
|
207
|
+
28 => Errors::UnfilteredDispatchingNotAllowedByLicenseError,
|
208
|
+
29 => Errors::RawModeNotAllowedByLicenseError,
|
209
|
+
30 => Errors::SubscriptionsNotAllowedByLicenseError,
|
210
|
+
32 => Errors::InvalidProgressiveNumberError,
|
211
|
+
33 => Errors::InvalidProgressiveNumberError,
|
212
|
+
60 => Errors::ClientVersionNotSupportedError
|
233
213
|
}.freeze
|
234
214
|
|
235
215
|
private_constant :API_ERROR_CODE_TO_CLASS
|
@@ -26,7 +26,7 @@ module Lightstreamer
|
|
26
26
|
# stored in this attribute. If the session is terminated as a result of calling {#disconnect} then the error will be
|
27
27
|
# {SessionEndError}.
|
28
28
|
#
|
29
|
-
# @return [
|
29
|
+
# @return [LightstreamerError, nil]
|
30
30
|
attr_reader :error
|
31
31
|
|
32
32
|
# Initializes this new Lightstreamer session with the passed options.
|
@@ -17,7 +17,7 @@ module Lightstreamer
|
|
17
17
|
# If an error occurs on the stream thread that causes the stream to disconnect then the error will be stored in this
|
18
18
|
# attribute.
|
19
19
|
#
|
20
|
-
# @return [
|
20
|
+
# @return [LightstreamerError, nil]
|
21
21
|
attr_reader :error
|
22
22
|
|
23
23
|
# Establishes a new stream connection using the authentication details from the passed session.
|
@@ -85,11 +85,11 @@ module Lightstreamer
|
|
85
85
|
@thread = Thread.new do
|
86
86
|
Thread.current.abort_on_exception = true
|
87
87
|
|
88
|
-
|
88
|
+
create_new_stream
|
89
89
|
|
90
90
|
while @loop
|
91
91
|
@loop = false
|
92
|
-
|
92
|
+
bind_to_existing_stream
|
93
93
|
end
|
94
94
|
|
95
95
|
@thread = nil
|
@@ -97,36 +97,32 @@ module Lightstreamer
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
def
|
100
|
+
def create_new_stream
|
101
101
|
params = { LS_op2: 'create', LS_cid: 'mgQkwtwdysogQz2BJ4Ji kOj2Bg', LS_user: @session.username,
|
102
102
|
LS_password: @session.password }
|
103
103
|
|
104
104
|
params[:LS_adapter_set] = @session.adapter_set if @session.adapter_set
|
105
105
|
|
106
|
-
|
106
|
+
execute_stream_post_request @stream_create_url, connect_timeout: 15, query: params
|
107
|
+
|
108
|
+
signal_connect_result_ready
|
107
109
|
end
|
108
110
|
|
109
|
-
def
|
110
|
-
|
111
|
+
def bind_to_existing_stream
|
112
|
+
execute_stream_post_request @stream_bind_url, connect_timeout: 15, query: { LS_session: @session_id }
|
111
113
|
end
|
112
114
|
|
113
|
-
def
|
115
|
+
def execute_stream_post_request(url, options)
|
114
116
|
@header = StreamConnectionHeader.new
|
115
117
|
|
116
118
|
buffer = LineBuffer.new
|
117
|
-
|
119
|
+
options[:response_block] = lambda do |data, _remaining_bytes, _total_bytes|
|
118
120
|
buffer.process data, &method(:process_stream_line)
|
119
121
|
end
|
120
122
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
signal_connect_result_ready
|
125
|
-
end
|
126
|
-
|
127
|
-
def on_request_complete(response)
|
128
|
-
@error = @header.error if @header
|
129
|
-
@error = RequestError.new(response.return_message, response.response_code) unless response.success?
|
123
|
+
Excon.post url, options
|
124
|
+
rescue Excon::Error => error
|
125
|
+
@error = Errors::ConnectionError.new error.message
|
130
126
|
end
|
131
127
|
|
132
128
|
def signal_connect_result_ready
|
@@ -142,12 +138,14 @@ module Lightstreamer
|
|
142
138
|
end
|
143
139
|
|
144
140
|
def process_header_line(line)
|
145
|
-
|
141
|
+
header_incomplete = @header.process_line line
|
146
142
|
|
147
143
|
@session_id = @header['SessionId']
|
148
144
|
@control_address = @header['ControlAddress']
|
149
145
|
@error = @header.error
|
150
146
|
|
147
|
+
return if header_incomplete
|
148
|
+
|
151
149
|
signal_connect_result_ready
|
152
150
|
|
153
151
|
@header = nil
|
@@ -157,7 +155,7 @@ module Lightstreamer
|
|
157
155
|
if line =~ /^LOOP/
|
158
156
|
@loop = true
|
159
157
|
elsif line =~ /^END/
|
160
|
-
@error = SessionEndError.new line[4..-1]
|
158
|
+
@error = Errors::SessionEndError.new line[4..-1]
|
161
159
|
elsif line !~ /^(PROBE|Preamble:.*)$/
|
162
160
|
@queue.push line
|
163
161
|
end
|
@@ -7,7 +7,7 @@ module Lightstreamer
|
|
7
7
|
# If there was an error in the header then this value will be set to the error instance that should be raised in
|
8
8
|
# response.
|
9
9
|
#
|
10
|
-
# @return [
|
10
|
+
# @return [LightstreamerError, nil]
|
11
11
|
attr_reader :error
|
12
12
|
|
13
13
|
def initialize
|
@@ -21,7 +21,7 @@ module Lightstreamer
|
|
21
21
|
# @param [String] line The line of header data to process.
|
22
22
|
#
|
23
23
|
# @return [Boolean] Whether the header is still incomplete and requires further data.
|
24
|
-
def
|
24
|
+
def process_line(line)
|
25
25
|
@lines << line
|
26
26
|
|
27
27
|
return process_success if @lines.first == 'OK'
|
@@ -58,12 +58,12 @@ module Lightstreamer
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def process_end
|
61
|
-
@error = SessionEndError.new @lines[1]
|
61
|
+
@error = Errors::SessionEndError.new @lines[1]
|
62
62
|
true
|
63
63
|
end
|
64
64
|
|
65
65
|
def process_sync_error
|
66
|
-
@error = SyncError.new
|
66
|
+
@error = Errors::SyncError.new
|
67
67
|
false
|
68
68
|
end
|
69
69
|
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightstreamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Viney
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: excon
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.51'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.51'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0.19'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0.19'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|