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.
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