MqttClient class
Mqtt client instance
Constructors
- MqttClient(ITransportClient client, {bool log = false, bool allowReconnect = false, Duration reconnectWait = const Duration(seconds: 2), Duration customReconnectDelayCB()?})
Properties
- allowReconnect ↔ bool
-
allow Reconnect when
getter/setter pair
- connectPacket → MqttMessageConnect
-
no setter
- customReconnectDelayCB ↔ (Duration Function()?)
-
custom reconnect delay
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- keepAlive ↔ Duration?
-
getter/setter pair
- lasthead ↔ MqttFixedHead?
-
getter/setter pair
- log ↔ bool
-
getter/setter pair
- paused → bool
-
no setter
- reconnectWait ↔ Duration
-
delay before reconnect
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transport ↔ ITransportClient
-
getter/setter pair
Methods
-
close(
[dynamic reson = "no reson"]) → void - close the connect
-
dispose(
) → void - eliminate functionality
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onBeforeReconnect(
Future< void> fn()?) → void -
onClose(
Future< void> fn()?) → void -
onMqttConack(
void fn(MqttMessageConnack msg)?) → void -
pause(
) → void - pause (ex: when app in backgroud mode)
-
publish(
String topic, {bool retain = false, MqttQos qos = MqttQos.qos0, bool dup = false, Uint8List? payload}) → Future< void> -
reSub(
) → void -
resume(
) → void - resume (ex:when app resume to fourcegroud mode)
-
start(
) → void - start connect
-
stop(
) → void - stop this client
-
subscribe(
String topic, {bool force = true, EvtMqttPublishArrived? onMessage, bool futureWaitData = false, bool retain = false, MqttQos qos = MqttQos.qos0, bool dup = false, Duration? timeout}) → Future< void> -
toString(
) → String -
A string representation of this object.
inherited
-
unSubscribe(
String topic) → Future< void> -
withAuth(
String userName, String pwd) → MqttClient - set ConnectPacket UserName and pwd
-
withClearSession(
bool clear) → MqttClient - set ConnectPacket clearSession default:true
-
withClientID(
String clientID) → MqttClient - set ConnectPacket clientID
-
withKeepalive(
int seconds) → MqttClient - set ConnectPacket ping keepaliveSecond
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance ↔ MqttClient?
-
getter/setter pair