em-eventsource 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/em-eventsource.rb +9 -5
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ec07f875ae92715156e29869ab067b4974c573982101c3c277ad12e7fd48bd7
4
- data.tar.gz: 334a6048430469e842a07d7fcce31f2f7628c3eaac8846c742c39b19a5010f32
3
+ metadata.gz: 461c9ac878e1f325156439b1d51c298db29fbcc9c23e769fdf0c480baeb83f57
4
+ data.tar.gz: 1b9077e69942f41ce43c304116bb7923b66cb398935e3da578b76e03176b60ec
5
5
  SHA512:
6
- metadata.gz: a414fff1fce900ccea8e036b39a22bf21b2e6a7a7af79148be176393767fce8364b9a40edacd7bd8c68c331d1bfbbc2fef6bf7e513060100994667e3d851cfc8
7
- data.tar.gz: 1767363f1a0ca930a9636091912301ccfa61ed03246aa2b4a0ad90e18c7afc26f585f75a27c1435ff750d162e34f716dbb7d5cde1b7ec869237f5cec0f961651
6
+ metadata.gz: b689983d0970f0f072d1f34ea79c47948b084072ce94b014ef4da1b340cc9c6673a00a1eece3fbe2585e56425090fb7d4186275d6d2f097abafcf1bcacc1e455
7
+ data.tar.gz: 65d3b2e2f93416796ec3f958cc9d64253fd24db69c944b5f08aeb6f964efec3715330c9dbc2de3f095273d647358e304465d812c7a1e03918eaa2270c8254ae7
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # EventSource client for EventMachine
2
2
 
3
- See the specification: http://dev.w3.org/html5/eventsource/
3
+ See the specification: https://html.spec.whatwg.org/multipage/server-sent-events.html
4
4
 
5
5
  ## Install
6
6
 
@@ -88,7 +88,8 @@ module EventMachine
88
88
  #
89
89
  # Returns nothing
90
90
  def use(*args, &block)
91
- @middlewares << (args << block)
91
+ block = args.pop if block.nil? && block_given?
92
+ @middlewares << [args, block]
92
93
  end
93
94
 
94
95
  # Start subscription
@@ -179,10 +180,13 @@ module EventMachine
179
180
 
180
181
  def prepare_request
181
182
  conn = EM::HttpRequest.new(@url, inactivity_timeout: @inactivity_timeout)
182
- @middlewares.each { |middleware|
183
- block = middleware.pop
184
- conn.use(*middleware, &block)
185
- }
183
+ @middlewares.each do |middleware, block|
184
+ if block
185
+ conn.use(*middleware, &block)
186
+ else
187
+ conn.use(*middleware)
188
+ end
189
+ end
186
190
  headers = @headers.merge({'Cache-Control' => 'no-cache', 'Accept' => 'text/event-stream'})
187
191
  headers.merge!({'Last-Event-Id' => @last_event_id }) if not @last_event_id.nil?
188
192
  [conn, conn.get({ query: @query,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-eventsource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - François de Metz