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
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This is a monkey patch to work around a missing method in OpenSSL. Older
|
4
|
+
# versions of OpenSSL were missing the `getbyte` method (regular sockets have
|
5
|
+
# a getbyte method but OpenSSL sockets didn't). We added `getbyte` to OpenSSL
|
6
|
+
# here: https://github.com/ruby/openssl/pull/438
|
7
|
+
#
|
8
|
+
# This patch is just to backport the `getbyte` method until folks are able to
|
9
|
+
# upgrade OpenSSL packages
|
10
|
+
unless OpenSSL::SSL::SSLSocket.method_defined?(:getbyte)
|
11
|
+
class OpenSSL::SSL::SSLSocket
|
12
|
+
def getbyte
|
13
|
+
byte = read(1)
|
14
|
+
byte && unpack_byte(byte)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
if ''.respond_to?(:unpack1)
|
20
|
+
def unpack_byte(str)
|
21
|
+
str.unpack1('C')
|
22
|
+
end
|
23
|
+
else
|
24
|
+
def unpack_byte(str)
|
25
|
+
str.unpack('C').first
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|