pubsubstub 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pubsubstub/stream_action.rb +15 -0
- data/lib/pubsubstub/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 557dce7bb9c5e9cc8a58b6200ee538e7464cb643
|
4
|
+
data.tar.gz: ee5d2428c3aa6ee5d8bb163d86f79c1e7c37155b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/pubsubstub/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|