Encodes a SUBSCRIBE packet.
Begins with the packet identifier, then a list of (topic filter, requested-QoS) pairs. The fixed-header flags nibble is the spec-mandated 0x2.
0x2
A non-zero packet identifier the matching SUBACK will echo.
One or more topic filters with their requested maximum QoS.
The SUBSCRIBE bytes.
If no subscriptions are supplied.
1.0.0
import { encodeSubscribe } from 'edgeport/mqtt';const bytes = encodeSubscribe(1, [{ topicFilter: 'sensors/+/temp', qos: 1 }]); Copy
import { encodeSubscribe } from 'edgeport/mqtt';const bytes = encodeSubscribe(1, [{ topicFilter: 'sensors/+/temp', qos: 1 }]);
Encodes a SUBSCRIBE packet.
Begins with the packet identifier, then a list of (topic filter, requested-QoS) pairs. The fixed-header flags nibble is the spec-mandated
0x2.