paho-mqtt 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +289 -10
- data/lib/paho-mqtt.rb +26 -8
- data/lib/{paho.mqtt/paho_client.rb → paho_mqtt/client.rb} +130 -99
- data/lib/paho_mqtt/packet.rb +19 -0
- data/lib/paho_mqtt/packet/base.rb +290 -0
- data/lib/paho_mqtt/packet/connack.rb +84 -0
- data/lib/paho_mqtt/packet/connect.rb +149 -0
- data/lib/paho_mqtt/packet/disconnect.rb +20 -0
- data/lib/paho_mqtt/packet/pingreq.rb +12 -0
- data/lib/paho_mqtt/packet/pingresp.rb +20 -0
- data/lib/paho_mqtt/packet/puback.rb +27 -0
- data/lib/paho_mqtt/packet/pubcomp.rb +26 -0
- data/lib/paho_mqtt/packet/publish.rb +127 -0
- data/lib/paho_mqtt/packet/pubrec.rb +26 -0
- data/lib/paho_mqtt/packet/pubrel.rb +44 -0
- data/lib/paho_mqtt/packet/suback.rb +56 -0
- data/lib/paho_mqtt/packet/subscribe.rb +104 -0
- data/lib/paho_mqtt/packet/unsuback.rb +31 -0
- data/lib/paho_mqtt/packet/unsubscribe.rb +65 -0
- data/lib/{paho.mqtt → paho_mqtt}/version.rb +1 -1
- data/paho-mqtt.gemspec +2 -2
- data/samples/client_blocking(writing).rb +16 -0
- data/samples/client_blocking.rb +34 -0
- data/samples/getting_started.rb +49 -0
- metadata +24 -8
- data/lib/paho.mqtt/packet_manager.rb +0 -1056
- data/paho-mqtt-0.0.1.gem +0 -0
- data/samples/test_aws.rb +0 -31
data/paho-mqtt-0.0.1.gem
DELETED
Binary file
|
data/samples/test_aws.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require "./paho_client"
|
2
|
-
require "./packet_manager"
|
3
|
-
require "json"
|
4
|
-
|
5
|
-
cli = PahoRuby::Client.new
|
6
|
-
cli.ssl = true
|
7
|
-
cli.config_ssl_context("/Users/Pierre/certs/certificate.pem.crt", "/Users/Pierre/certs/private.pem.key", "/Users/Pierre/certs/root-CA.crt")
|
8
|
-
|
9
|
-
cli.connect('a15ipmbgzhr3uc.iot.ap-northeast-1.amazonaws.com', 8883)
|
10
|
-
|
11
|
-
cli.subscribe(["topic1", 1], ["topic2", 1])
|
12
|
-
sleep 2
|
13
|
-
|
14
|
-
#cli.on_message = lambda { |topic, payload, qos| puts ">>>>> This is a LAMBDA callback for message event <<<<<\nTopic: #{topic}\nPayload: #{payload}\nQoS: #{qos}" }
|
15
|
-
|
16
|
-
cli.add_topic_callback('topic1') do
|
17
|
-
puts "I am callback for topic 1"
|
18
|
-
end
|
19
|
-
|
20
|
-
cli.add_topic_callback('topic2') do
|
21
|
-
puts "I am callback for topic 2"
|
22
|
-
end
|
23
|
-
|
24
|
-
cli.publish("topic1", "Hi there! My name is PahoRuby.", false, 1)
|
25
|
-
cli.publish("topic2", "Hi there! My name is PahoRuby2.", false, 1)
|
26
|
-
|
27
|
-
#payload = JSON.generate({ :state => { :desired => { :aisatsu => "こんばは" }}})
|
28
|
-
#cli.publish("$aws/things/MyRasPi/shadow/update", payload, false, 1)
|
29
|
-
sleep 2
|
30
|
-
|
31
|
-
cli.disconnect
|