em-cometio-client 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/em-cometio-client/version.rb +1 -1
- data/test/app/config.ru +1 -0
- data/test/app/main.rb +7 -5
- data/test/test_helper.rb +2 -2
- metadata +2 -2
data/History.txt
CHANGED
data/test/app/config.ru
CHANGED
data/test/app/main.rb
CHANGED
@@ -3,27 +3,29 @@ File.open(pid_file, "w+") do |f|
|
|
3
3
|
f.write Process.pid.to_s
|
4
4
|
end
|
5
5
|
|
6
|
-
class TestApp < Sinatra::
|
6
|
+
class TestApp < Sinatra::Base
|
7
|
+
register Sinatra::CometIO
|
8
|
+
io = Sinatra::CometIO
|
7
9
|
|
8
10
|
get '/' do
|
9
11
|
"sinatra-cometio v#{Sinatra::CometIO::VERSION}"
|
10
12
|
end
|
11
13
|
|
12
|
-
|
14
|
+
io.on :connect do |session|
|
13
15
|
puts "new client <#{session}>"
|
14
16
|
end
|
15
17
|
|
16
|
-
|
18
|
+
io.on :disconnect do |session|
|
17
19
|
puts "disconnect client <#{session}>"
|
18
20
|
end
|
19
21
|
|
20
|
-
|
22
|
+
io.on :broadcast do |data, from|
|
21
23
|
puts from
|
22
24
|
puts "broadcast <#{from}> - #{data.to_json}"
|
23
25
|
push :broadcast, data
|
24
26
|
end
|
25
27
|
|
26
|
-
|
28
|
+
io.on :message do |data, from|
|
27
29
|
puts "message <#{from}> - #{data.to_json}"
|
28
30
|
push :message, data, :to => data['to']
|
29
31
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
|
2
4
|
require 'minitest/autorun'
|
3
5
|
require 'em-cometio-client'
|
4
6
|
require File.expand_path 'app', File.dirname(__FILE__)
|
5
7
|
|
6
|
-
$:.unshift File.expand_path '../lib', File.dirname(__FILE__)
|
7
|
-
|
8
8
|
['SIGHUP', 'SIGINT', 'SIGKILL', 'SIGTERM'].each do |sig|
|
9
9
|
Kernel.trap sig do
|
10
10
|
App.stop
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-cometio-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|