go-mqtt 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.md +21 -0
- data/NEWS.md +150 -0
- data/README.md +237 -0
- data/lib/mqtt/client.rb +755 -0
- data/lib/mqtt/openssl_fix.rb +29 -0
- data/lib/mqtt/packet.rb +1049 -0
- data/lib/mqtt/proxy.rb +115 -0
- data/lib/mqtt/sn/packet.rb +720 -0
- data/lib/mqtt/version.rb +4 -0
- data/lib/mqtt.rb +48 -0
- data/spec/mqtt_client_spec.rb +1124 -0
- data/spec/mqtt_packet_spec.rb +2012 -0
- data/spec/mqtt_proxy_spec.rb +8 -0
- data/spec/mqtt_sn_packet_spec.rb +1721 -0
- data/spec/mqtt_version_spec.rb +23 -0
- data/spec/zz_client_integration_spec.rb +177 -0
- metadata +152 -0
data/lib/mqtt.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'logger'
|
4
|
+
require 'socket'
|
5
|
+
require 'thread'
|
6
|
+
require 'timeout'
|
7
|
+
|
8
|
+
require 'mqtt/version'
|
9
|
+
|
10
|
+
module MQTT
|
11
|
+
# Default port number for unencrypted connections
|
12
|
+
DEFAULT_PORT = 1883
|
13
|
+
|
14
|
+
# Default port number for TLS/SSL encrypted connections
|
15
|
+
DEFAULT_SSL_PORT = 8883
|
16
|
+
|
17
|
+
# Super-class for other MQTT related exceptions
|
18
|
+
class Exception < ::Exception
|
19
|
+
end
|
20
|
+
|
21
|
+
# A ProtocolException will be raised if there is a
|
22
|
+
# problem with data received from a remote host
|
23
|
+
class ProtocolException < MQTT::Exception
|
24
|
+
end
|
25
|
+
|
26
|
+
# A NotConnectedException will be raised when trying to
|
27
|
+
# perform a function but no connection has been
|
28
|
+
# established
|
29
|
+
class NotConnectedException < MQTT::Exception
|
30
|
+
end
|
31
|
+
|
32
|
+
autoload :Client, 'mqtt/client'
|
33
|
+
autoload :Packet, 'mqtt/packet'
|
34
|
+
autoload :Proxy, 'mqtt/proxy'
|
35
|
+
|
36
|
+
# MQTT-SN
|
37
|
+
module SN
|
38
|
+
# Default port number for unencrypted connections
|
39
|
+
DEFAULT_PORT = 1883
|
40
|
+
|
41
|
+
# A ProtocolException will be raised if there is a
|
42
|
+
# problem with data received from a remote host
|
43
|
+
class ProtocolException < MQTT::Exception
|
44
|
+
end
|
45
|
+
|
46
|
+
autoload :Packet, 'mqtt/sn/packet'
|
47
|
+
end
|
48
|
+
end
|