pubsubstub 0.0.6 → 0.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8550c78aff6963d9bac3a9665518f6ee0aec9dc
4
- data.tar.gz: fea96f48f595f51acc4aa5b4b3fa5e15681ff968
3
+ metadata.gz: 557dce7bb9c5e9cc8a58b6200ee538e7464cb643
4
+ data.tar.gz: ee5d2428c3aa6ee5d8bb163d86f79c1e7c37155b
5
5
  SHA512:
6
- metadata.gz: dd2bc2f598f12007319a20c1943a4ade7ef39c27479fac1c0b1db61a85c6d5e670cd88b365f5f7249cf2ce679db6e854f5cd188709dff8dff47f53a71519f251
7
- data.tar.gz: 1c128dd712f5dbbeb5e5f285502b897f583e9b21cb8d0dc9fcbf58fb1826e341c4ac554f37dc8ad66877fc626de1c4c74d38d3db568c8ad61c2077825ac44b68
6
+ metadata.gz: 6577992017a7aa57349c0b1f29ebc1c9c942df78ed77400285674bacaf141ac97cab50465f201fb5b7411c9db07b1108a7042c0e790e40aa9f5e06f285386e95
7
+ data.tar.gz: f6d714360eb9d0c73fadb36cec04adcab8663a43bda48c2300535d5a16da53061f0d604ed34d2bd238920f3a6928c35f65b9b967ca98054a1f0abbab210275ea
@@ -1,5 +1,10 @@
1
1
  module Pubsubstub
2
2
  class StreamAction < Pubsubstub::Action
3
+ def initialize(*)
4
+ super
5
+ start_heartbeat
6
+ end
7
+
3
8
  get '/', provides: 'text/event-stream' do
4
9
  status(200)
5
10
  headers({
@@ -22,5 +27,15 @@ module Pubsubstub
22
27
  end
23
28
  end
24
29
  end
30
+
31
+ private
32
+ def start_heartbeat
33
+ @heartbeat = Thread.new do
34
+ while true
35
+ sleep 15
36
+ @connections.each { |connection| connection << "\n" }
37
+ end
38
+ end
39
+ end
25
40
  end
26
41
  end
@@ -1,3 +1,3 @@
1
1
  module Pubsubstub
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubsubstub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Malette
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-01 00:00:00.000000000 Z
11
+ date: 2014-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra