lightstreamer 0.14 → 0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/LICENSE.md +1 -1
- data/README.md +12 -15
- data/bin/lightstreamer +1 -1
- data/lib/lightstreamer.rb +0 -1
- data/lib/lightstreamer/cli/commands/stream_command.rb +1 -1
- data/lib/lightstreamer/errors.rb +1 -1
- data/lib/lightstreamer/messages/update_message.rb +1 -1
- data/lib/lightstreamer/post_request.rb +3 -2
- data/lib/lightstreamer/session.rb +5 -5
- data/lib/lightstreamer/stream_connection.rb +7 -5
- data/lib/lightstreamer/subscription.rb +1 -1
- data/lib/lightstreamer/subscription_item_data.rb +1 -1
- data/lib/lightstreamer/version.rb +1 -1
- metadata +46 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e7a5166d6a0e3ab3612f9a13848ca9475ea0f0fae7139d5ad70bdf9fbe6b0a43
|
4
|
+
data.tar.gz: 3b0e4316482c751fedcc86b76fb7f202c3b5863df8559a47c7fc211c8556f1aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13f500f634589f1197eb2810b7f51f06a52b80827a7b62a8f8e37db4d3eac132651e7bde105b78b33c96df14d9c856c9ceadd673a00296a2ff06f5118da9103d
|
7
|
+
data.tar.gz: 17e84feb6e0b66561ee2b9d4b40be8ed70ab882fa374a3e49d217ec0f9aa542605fb2c6c57b68cb7e40cc6d0bc572d9ef5b6659351435481bfc2550135d89d4f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Lightstreamer Changelog
|
2
2
|
|
3
|
+
### 0.15 — September 12, 2019
|
4
|
+
|
5
|
+
- Updated supported Ruby version range to 2.4 - 2.6.
|
6
|
+
- Switched to `cc-test-reporter` now that the `codeclimate-test-reporter` gem has been deprecated.
|
7
|
+
|
3
8
|
### 0.14 — December 7, 2016
|
4
9
|
|
5
10
|
- Increased required Ruby version to >= 2.2.2
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
[![Build Status][travis-ci-badge]][travis-ci-link]
|
5
5
|
[![Test Coverage][test-coverage-badge]][test-coverage-link]
|
6
6
|
[![Code Climate][code-climate-badge]][code-climate-link]
|
7
|
-
[![Dependencies][dependencies-badge]][dependencies-link]
|
8
7
|
[![Documentation][documentation-badge]][documentation-link]
|
9
8
|
[![License][license-badge]][license-link]
|
10
9
|
|
@@ -40,8 +39,8 @@ $ gem install lightstreamer
|
|
40
39
|
|
41
40
|
The two primary classes that make up the public API are:
|
42
41
|
|
43
|
-
- [`Lightstreamer::Session`](http://www.rubydoc.info/github/
|
44
|
-
- [`Lightstreamer::Subscription`](http://www.rubydoc.info/github/
|
42
|
+
- [`Lightstreamer::Session`](http://www.rubydoc.info/github/richard-viney/lightstreamer/master/Lightstreamer/Session)
|
43
|
+
- [`Lightstreamer::Subscription`](http://www.rubydoc.info/github/richard-viney/lightstreamer/master/Lightstreamer/Subscription)
|
45
44
|
|
46
45
|
The following code demonstrates how to create a Lightstreamer session, build a subscription, then use a thread-safe
|
47
46
|
queue to print streaming output as it arrives.
|
@@ -106,7 +105,7 @@ lightstreamer help stream
|
|
106
105
|
|
107
106
|
## Documentation
|
108
107
|
|
109
|
-
API documentation is available [here](http://www.rubydoc.info/github/
|
108
|
+
API documentation is available [here](http://www.rubydoc.info/github/richard-viney/lightstreamer/master).
|
110
109
|
|
111
110
|
## Contributors
|
112
111
|
|
@@ -114,15 +113,13 @@ Gem created by Richard Viney. All contributions welcome.
|
|
114
113
|
|
115
114
|
[gem-link]: https://rubygems.org/gems/lightstreamer
|
116
115
|
[gem-badge]: https://badge.fury.io/rb/lightstreamer.svg
|
117
|
-
[travis-ci-link]: http://travis-ci.org/
|
118
|
-
[travis-ci-badge]: https://travis-ci.org/
|
119
|
-
[test-coverage-link]: https://codeclimate.com/github/
|
120
|
-
[test-coverage-badge]: https://codeclimate.com/
|
121
|
-
[code-climate-link]: https://codeclimate.com/github/
|
122
|
-
[code-climate-badge]: https://codeclimate.com/
|
123
|
-
[
|
124
|
-
[
|
125
|
-
[
|
126
|
-
[documentation-badge]: https://inch-ci.org/github/rviney/lightstreamer.svg?branch=master
|
127
|
-
[license-link]: https://github.com/rviney/lightstreamer/blob/master/LICENSE.md
|
116
|
+
[travis-ci-link]: http://travis-ci.org/richard-viney/lightstreamer
|
117
|
+
[travis-ci-badge]: https://travis-ci.org/richard-viney/lightstreamer.svg?branch=master
|
118
|
+
[test-coverage-link]: https://codeclimate.com/github/richard-viney/lightstreamer/test_coverage
|
119
|
+
[test-coverage-badge]: https://api.codeclimate.com/v1/badges/75ed2d421612ef3be0c1/test_coverage
|
120
|
+
[code-climate-link]: https://codeclimate.com/github/richard-viney/lightstreamer
|
121
|
+
[code-climate-badge]: https://api.codeclimate.com/v1/badges/75ed2d421612ef3be0c1/maintainability
|
122
|
+
[documentation-link]: https://inch-ci.org/github/richard-viney/lightstreamer
|
123
|
+
[documentation-badge]: https://inch-ci.org/github/richard-viney/lightstreamer.svg?branch=master
|
124
|
+
[license-link]: https://github.com/richard-viney/lightstreamer/blob/master/LICENSE.md
|
128
125
|
[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg
|
data/bin/lightstreamer
CHANGED
data/lib/lightstreamer.rb
CHANGED
@@ -14,7 +14,7 @@ module Lightstreamer
|
|
14
14
|
option :data_adapter, desc: 'The name of the data adapter to stream data from'
|
15
15
|
option :items, type: :array, required: true, desc: 'The names of the item(s) to stream'
|
16
16
|
option :fields, type: :array, required: true, desc: 'The field(s) to stream'
|
17
|
-
option :mode, enum: %w
|
17
|
+
option :mode, enum: %w[command distinct merge raw], desc: 'The operation mode'
|
18
18
|
option :selector, desc: 'The selector for table items'
|
19
19
|
option :snapshot, type: :boolean, desc: 'Whether to send snapshot data for the items'
|
20
20
|
option :maximum_update_frequency, desc: 'The maximum number of updates per second for each item'
|
data/lib/lightstreamer/errors.rb
CHANGED
@@ -37,8 +37,8 @@ module Lightstreamer
|
|
37
37
|
raise LightstreamerError if errors.size != bodies.size
|
38
38
|
|
39
39
|
errors
|
40
|
-
rescue Excon::Error =>
|
41
|
-
raise Errors::ConnectionError,
|
40
|
+
rescue Excon::Error => e
|
41
|
+
raise Errors::ConnectionError, e.message
|
42
42
|
end
|
43
43
|
|
44
44
|
# Returns the request body to send for a POST request with the given options.
|
@@ -51,6 +51,7 @@ module Lightstreamer
|
|
51
51
|
|
52
52
|
query.each do |key, value|
|
53
53
|
next if value.nil?
|
54
|
+
|
54
55
|
value = value.map(&:to_s).join(' ') if value.is_a? Array
|
55
56
|
params[key] = value
|
56
57
|
end
|
@@ -73,7 +73,7 @@ module Lightstreamer
|
|
73
73
|
@stream_connection.connect
|
74
74
|
|
75
75
|
create_processing_thread
|
76
|
-
rescue
|
76
|
+
rescue StandardError
|
77
77
|
@stream_connection = nil
|
78
78
|
raise
|
79
79
|
end
|
@@ -89,7 +89,7 @@ module Lightstreamer
|
|
89
89
|
#
|
90
90
|
# @return [String, nil]
|
91
91
|
def session_id
|
92
|
-
@stream_connection
|
92
|
+
@stream_connection&.session_id
|
93
93
|
end
|
94
94
|
|
95
95
|
# Disconnects this Lightstreamer session and terminates the session on the server. All worker threads are exited,
|
@@ -97,10 +97,10 @@ module Lightstreamer
|
|
97
97
|
def disconnect
|
98
98
|
control_request LS_op: :destroy if @stream_connection
|
99
99
|
|
100
|
-
@processing_thread
|
100
|
+
@processing_thread&.join 5
|
101
101
|
ensure
|
102
|
-
@stream_connection
|
103
|
-
@processing_thread
|
102
|
+
@stream_connection&.disconnect
|
103
|
+
@processing_thread&.exit
|
104
104
|
|
105
105
|
@subscriptions.each { |subscription| subscription.after_control_request :stop }
|
106
106
|
@subscriptions = []
|
@@ -35,6 +35,7 @@ module Lightstreamer
|
|
35
35
|
# {#initialize}. Raises a {LightstreamerError} subclass on failure.
|
36
36
|
def connect
|
37
37
|
return if @thread
|
38
|
+
|
38
39
|
@queue.clear
|
39
40
|
|
40
41
|
@connect_result_mutex.synchronize do
|
@@ -132,8 +133,8 @@ module Lightstreamer
|
|
132
133
|
options[:expects] = 200
|
133
134
|
|
134
135
|
Excon.post url, options
|
135
|
-
rescue Excon::Error =>
|
136
|
-
@error = Errors::ConnectionError.new
|
136
|
+
rescue Excon::Error => e
|
137
|
+
@error = Errors::ConnectionError.new e.message
|
137
138
|
end
|
138
139
|
|
139
140
|
def signal_connect_result_ready
|
@@ -141,7 +142,7 @@ module Lightstreamer
|
|
141
142
|
end
|
142
143
|
|
143
144
|
def process_stream_line(line)
|
144
|
-
return if
|
145
|
+
return if /^(PROBE|Preamble:.*)$/.match?(line)
|
145
146
|
|
146
147
|
if @header
|
147
148
|
process_header_line line
|
@@ -164,15 +165,16 @@ module Lightstreamer
|
|
164
165
|
@error = @header.error
|
165
166
|
|
166
167
|
return if header_incomplete
|
168
|
+
|
167
169
|
@header = nil
|
168
170
|
|
169
171
|
signal_connect_result_ready
|
170
172
|
end
|
171
173
|
|
172
174
|
def process_body_line(line)
|
173
|
-
if
|
175
|
+
if /^LOOP( \d+|)$/.match?(line)
|
174
176
|
@loop = true
|
175
|
-
elsif
|
177
|
+
elsif /^END( \d+|)$/.match?(line)
|
176
178
|
@error = Errors::SessionEndError.new line[4..-1]
|
177
179
|
elsif !line.empty?
|
178
180
|
@queue.push line
|
@@ -142,7 +142,7 @@ module Lightstreamer
|
|
142
142
|
index = @items.index item_name
|
143
143
|
raise ArgumentError, 'Unknown item' unless index
|
144
144
|
|
145
|
-
@mutex.synchronize { @data[index].data
|
145
|
+
@mutex.synchronize { @data[index].data&.dup }
|
146
146
|
end
|
147
147
|
|
148
148
|
# Sets the current data for the item with the specified name. This is only allowed when {mode} is `:command` or
|
@@ -14,7 +14,7 @@ module Lightstreamer
|
|
14
14
|
# @param [Array, Hash] new_data The new data for the item.
|
15
15
|
# @param [:command, :merge] mode The subscription mode.
|
16
16
|
def set_data(new_data, mode)
|
17
|
-
raise ArgumentError, "Data can't be set unless mode is :command or :merge" unless [
|
17
|
+
raise ArgumentError, "Data can't be set unless mode is :command or :merge" unless %i[command merge].include? mode
|
18
18
|
raise ArgumentError, 'Data must be a hash when in merge mode' if mode == :merge && !new_data.is_a?(Hash)
|
19
19
|
|
20
20
|
validate_rows new_data if mode == :command
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightstreamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.15'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Viney
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -16,140 +16,154 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.66'
|
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.66'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.20'
|
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: '0.
|
40
|
+
version: '0.20'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: factory_bot
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '5.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '5.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: github-markup
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: redcarpet
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3.3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.8'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.8'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name: rspec
|
98
|
+
name: rspec-mocks
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '3.
|
103
|
+
version: '3.8'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '3.
|
110
|
+
version: '3.8'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rubocop
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '0.74'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '0.74'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop
|
126
|
+
name: rubocop-performance
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.4'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.4'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop-rspec
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
143
|
- - "~>"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
145
|
+
version: '1.35'
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
150
|
- - "~>"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
152
|
+
version: '1.35'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: simplecov
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
157
|
- - "~>"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0.
|
159
|
+
version: '0.17'
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
164
|
- - "~>"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0.
|
166
|
+
version: '0.17'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: yard
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -191,7 +205,7 @@ files:
|
|
191
205
|
- lib/lightstreamer/subscription.rb
|
192
206
|
- lib/lightstreamer/subscription_item_data.rb
|
193
207
|
- lib/lightstreamer/version.rb
|
194
|
-
homepage: https://github.com/
|
208
|
+
homepage: https://github.com/richard-viney/lightstreamer
|
195
209
|
licenses:
|
196
210
|
- MIT
|
197
211
|
metadata: {}
|
@@ -203,7 +217,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
217
|
requirements:
|
204
218
|
- - ">="
|
205
219
|
- !ruby/object:Gem::Version
|
206
|
-
version: 2.
|
220
|
+
version: 2.4.0
|
207
221
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
208
222
|
requirements:
|
209
223
|
- - ">="
|
@@ -211,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
225
|
version: '0'
|
212
226
|
requirements: []
|
213
227
|
rubyforge_project:
|
214
|
-
rubygems_version: 2.
|
228
|
+
rubygems_version: 2.7.6
|
215
229
|
signing_key:
|
216
230
|
specification_version: 4
|
217
231
|
summary: Library and command-line client for accessing a Lightstreamer server.
|