em-mqtt 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -30,17 +30,13 @@ Synopsis
30
30
  end
31
31
  end
32
32
 
33
-
34
33
  # Subscribe example
35
- class MyConnection < EventMachine::MQTT::ClientConnection
36
- def receive_msg(packet)
37
- p packet
38
- end
39
- end
40
-
41
34
  EventMachine.run do
42
- MyConnection.connect('test.mosquitto.org') do |c|
35
+ EventMachine::MQTT::ClientConnection.connect('test.mosquitto.org') do |c|
43
36
  c.subscribe('test')
37
+ c.receive_callback do |message|
38
+ p message
39
+ end
44
40
  end
45
41
  end
46
42
 
@@ -48,8 +48,13 @@ class EventMachine::MQTT::ClientConnection < EventMachine::MQTT::Connection
48
48
  @state = :disconnecting
49
49
  end
50
50
 
51
+ def receive_callback(&block)
52
+ @receive_callback = block
53
+ end
54
+
51
55
  def receive_msg(message)
52
- # Subclass this method
56
+ # Alternatively, subclass this method
57
+ @receive_callback.call(message) unless @receive_callback.nil?
53
58
  end
54
59
 
55
60
  def unbind
@@ -96,7 +96,8 @@ class EventMachine::MQTT::ServerConnection < EventMachine::MQTT::Connection
96
96
  self.subscriptions << topic
97
97
  end
98
98
  logger.info("#{client_id} has subscriptions: #{self.subscriptions}")
99
- # FIXME: send subscribe acknowledgement?
99
+
100
+ # FIXME: send subscribe acknowledgement
100
101
  end
101
102
 
102
103
  def publish(packet)
@@ -1,5 +1,5 @@
1
1
  module EventMachine
2
2
  module MQTT
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-mqtt
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease: false
4
+ hash: 27
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nicholas J Humfrey
@@ -15,10 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-04 00:00:00 +00:00
19
- default_executable:
18
+ date: 2012-09-16 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
21
+ name: eventmachine
22
+ prerelease: false
22
23
  requirement: &id001 !ruby/object:Gem::Requirement
23
24
  none: false
24
25
  requirements:
@@ -29,10 +30,10 @@ dependencies:
29
30
  - 0
30
31
  version: "0"
31
32
  type: :runtime
32
- name: eventmachine
33
- prerelease: false
34
33
  version_requirements: *id001
35
34
  - !ruby/object:Gem::Dependency
35
+ name: mqtt
36
+ prerelease: false
36
37
  requirement: &id002 !ruby/object:Gem::Requirement
37
38
  none: false
38
39
  requirements:
@@ -45,10 +46,10 @@ dependencies:
45
46
  - 8
46
47
  version: 0.0.8
47
48
  type: :runtime
48
- name: mqtt
49
- prerelease: false
50
49
  version_requirements: *id002
51
50
  - !ruby/object:Gem::Dependency
51
+ name: bundler
52
+ prerelease: false
52
53
  requirement: &id003 !ruby/object:Gem::Requirement
53
54
  none: false
54
55
  requirements:
@@ -61,10 +62,10 @@ dependencies:
61
62
  - 7
62
63
  version: 1.0.7
63
64
  type: :development
64
- name: bundler
65
- prerelease: false
66
65
  version_requirements: *id003
67
66
  - !ruby/object:Gem::Dependency
67
+ name: yard
68
+ prerelease: false
68
69
  requirement: &id004 !ruby/object:Gem::Requirement
69
70
  none: false
70
71
  requirements:
@@ -77,10 +78,10 @@ dependencies:
77
78
  - 2
78
79
  version: 0.7.2
79
80
  type: :development
80
- name: yard
81
- prerelease: false
82
81
  version_requirements: *id004
83
82
  - !ruby/object:Gem::Dependency
83
+ name: rake
84
+ prerelease: false
84
85
  requirement: &id005 !ruby/object:Gem::Requirement
85
86
  none: false
86
87
  requirements:
@@ -93,10 +94,10 @@ dependencies:
93
94
  - 7
94
95
  version: 0.8.7
95
96
  type: :development
96
- name: rake
97
- prerelease: false
98
97
  version_requirements: *id005
99
98
  - !ruby/object:Gem::Dependency
99
+ name: rspec
100
+ prerelease: false
100
101
  requirement: &id006 !ruby/object:Gem::Requirement
101
102
  none: false
102
103
  requirements:
@@ -109,10 +110,10 @@ dependencies:
109
110
  - 0
110
111
  version: 2.6.0
111
112
  type: :development
112
- name: rspec
113
- prerelease: false
114
113
  version_requirements: *id006
115
114
  - !ruby/object:Gem::Dependency
115
+ name: mocha
116
+ prerelease: false
116
117
  requirement: &id007 !ruby/object:Gem::Requirement
117
118
  none: false
118
119
  requirements:
@@ -125,10 +126,10 @@ dependencies:
125
126
  - 0
126
127
  version: 0.10.0
127
128
  type: :development
128
- name: mocha
129
- prerelease: false
130
129
  version_requirements: *id007
131
130
  - !ruby/object:Gem::Dependency
131
+ name: rcov
132
+ prerelease: false
132
133
  requirement: &id008 !ruby/object:Gem::Requirement
133
134
  none: false
134
135
  requirements:
@@ -141,8 +142,6 @@ dependencies:
141
142
  - 0
142
143
  version: 0.9.0
143
144
  type: :development
144
- name: rcov
145
- prerelease: false
146
145
  version_requirements: *id008
147
146
  description: This gem adds MQTT (Message Queue Telemetry Transport) protocol support to EventMachine.
148
147
  email: njh@aelius.com
@@ -157,16 +156,15 @@ files:
157
156
  - COPYING
158
157
  - GPL
159
158
  - NEWS
160
- - lib/em-mqtt/version.rb
159
+ - lib/em-mqtt/client.rb.new.rb
161
160
  - lib/em-mqtt/client_connection.rb
161
+ - lib/em-mqtt/connection.rb
162
162
  - lib/em-mqtt/server.rb
163
163
  - lib/em-mqtt/server_connection.rb
164
- - lib/em-mqtt/client.rb.new.rb
165
- - lib/em-mqtt/connection.rb
164
+ - lib/em-mqtt/version.rb
166
165
  - lib/em-mqtt.rb
167
166
  - spec/em_mqtt_version_spec.rb
168
167
  - bin/em-mqtt
169
- has_rdoc: true
170
168
  homepage: http://github.com/njh/ruby-em-mqtt
171
169
  licenses:
172
170
  - Ruby
@@ -196,9 +194,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
194
  requirements: []
197
195
 
198
196
  rubyforge_project:
199
- rubygems_version: 1.3.7
197
+ rubygems_version: 1.8.11
200
198
  signing_key:
201
199
  specification_version: 3
202
200
  summary: MQTT for EventMachine
203
201
  test_files:
204
202
  - spec/em_mqtt_version_spec.rb
203
+ has_rdoc: