ld-eventsource 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/ld-eventsource/impl/event_parser.rb +14 -8
- data/lib/ld-eventsource/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3ce08e7a1cf60a7a5dbbe1dfdaa98c4391a625a05b91e47907e80f02ad5a301
|
4
|
+
data.tar.gz: 35009bae9547b7db1bfbd9e4561e58594d6471d44b379436e43d78894fbcfb6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7c0915fddc58ed5629eda81b30b7d843a7689ae58ebe01e45f0451d125aa4033d8ad47f50832645b64a97662155cd9ff0e2fa077fc269a604f9bc6ef8a5a27d
|
7
|
+
data.tar.gz: 0a0b2dc61b40ec7b48d32ff3449a70712d9e1ea17e2708eb62d7fce68b5f61d722709d6b244efdf908c47d6ed43cc0e70eec8fe80006478658ce3838f837737a
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
LaunchDarkly SSE Client for Ruby
|
2
2
|
================================
|
3
3
|
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/ld-eventsource.svg)](http://badge.fury.io/rb/ld-eventsource) [![Circle CI](https://circleci.com/gh/launchdarkly/ruby-eventsource/tree/
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/ld-eventsource.svg)](http://badge.fury.io/rb/ld-eventsource) [![Circle CI](https://circleci.com/gh/launchdarkly/ruby-eventsource/tree/main.svg?style=svg)](https://circleci.com/gh/launchdarkly/ruby-eventsource/tree/main)
|
5
5
|
|
6
6
|
A client for the [Server-Sent Events](https://www.w3.org/TR/eventsource/) protocol. This implementation runs on a worker thread, and uses the [`http`](https://rubygems.org/gems/http) gem to manage a persistent connection. Its primary purpose is to support the [LaunchDarkly SDK for Ruby](https://github.com/launchdarkly/ruby-client), but it can be used independently.
|
7
7
|
|
@@ -37,12 +37,15 @@ module SSE
|
|
37
37
|
event = maybe_create_event
|
38
38
|
reset_buffers
|
39
39
|
gen.yield event if !event.nil?
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
40
|
+
elsif (pos = line.index(':'))
|
41
|
+
name = line.slice(0...pos)
|
42
|
+
|
43
|
+
pos += 1 # skip colon
|
44
|
+
pos += 1 if pos < line.length && line[pos] == ' ' # skip optional single space, per SSE spec
|
45
|
+
line = line.slice(pos..-1)
|
46
|
+
|
47
|
+
item = process_field(name, line)
|
48
|
+
gen.yield item if !item.nil?
|
46
49
|
end
|
47
50
|
end
|
48
51
|
end
|
@@ -62,8 +65,11 @@ module SSE
|
|
62
65
|
when "event"
|
63
66
|
@type = value.to_sym
|
64
67
|
when "data"
|
65
|
-
|
66
|
-
|
68
|
+
if @have_data
|
69
|
+
@data << "\n" << value
|
70
|
+
else
|
71
|
+
@data = value
|
72
|
+
end
|
67
73
|
@have_data = true
|
68
74
|
when "id"
|
69
75
|
if !value.include?("\x00")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ld-eventsource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LaunchDarkly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
|
-
rubygems_version: 3.3.
|
139
|
+
rubygems_version: 3.3.16
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: LaunchDarkly SSE client
|