stomping_ground 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stomping_ground/server.rb +16 -13
- data/lib/stomping_ground/version.rb +1 -1
- metadata +13 -13
@@ -10,27 +10,30 @@ module StompingGround
|
|
10
10
|
def receive_data frame
|
11
11
|
frame_info = parse(frame)
|
12
12
|
case frame_info[:command]
|
13
|
-
|
13
|
+
when "CONNECT"
|
14
14
|
send_data "CONNECTED\n"
|
15
15
|
send_data "version:1.1\n"
|
16
16
|
send_data "\n"
|
17
17
|
send_data "\0"
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
when "DISCONNECT"
|
18
|
+
when "SUBSCRIBE"
|
19
|
+
message = @message_body || "hello"
|
20
|
+
send_data "MESSAGE\n"
|
21
|
+
send_data "subscription:#{frame_info[:id]}\n"
|
22
|
+
send_data "message-id:007\n"
|
23
|
+
send_data "destination:#{frame_info[:destination]}\n"
|
24
|
+
send_data "content-type:text/plain\n"
|
25
|
+
send_data "content-length:#{message.length}\n"
|
26
|
+
send_data "\n"
|
27
|
+
send_data "#{message}\0"
|
28
|
+
when "DISCONNECT"
|
30
29
|
send_data "RECEIPT\n"
|
31
30
|
send_data "receipt-id:99\n"
|
32
31
|
send_data "\0"
|
33
32
|
close_connection
|
33
|
+
when "SEND"
|
34
|
+
File.open("stomping_ground_message.txt", "w") do |file|
|
35
|
+
file.write(frame)
|
36
|
+
end
|
34
37
|
end
|
35
38
|
end
|
36
39
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stomping_ground
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: onstomp
|
16
|
-
requirement: &
|
16
|
+
requirement: &2164809700 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2164809700
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &2164809240 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2164809240
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: json
|
38
|
-
requirement: &
|
38
|
+
requirement: &2164808800 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2164808800
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
|
-
requirement: &
|
49
|
+
requirement: &2164808220 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2164808220
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: eventmachine
|
60
|
-
requirement: &
|
60
|
+
requirement: &2164807460 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2164807460
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
executables: []
|
@@ -75,7 +75,7 @@ files:
|
|
75
75
|
- lib/stomping_ground/server.rb
|
76
76
|
- lib/stomping_ground/version.rb
|
77
77
|
- lib/stomping_ground.rb
|
78
|
-
homepage:
|
78
|
+
homepage:
|
79
79
|
licenses: []
|
80
80
|
post_install_message:
|
81
81
|
rdoc_options: []
|