MemoryTransport class
An MqttTransport connected to a MemoryBroker.
Pass it to a client in tests:
final client = BedayaClient(
ClientConfig(host: 'memory'), // host is not used
transport: MemoryTransport(broker),
);
Like a real connection, it forgets its subscriptions when it drops; the client restores them.
- Implemented types
Constructors
- MemoryTransport(MemoryBroker broker)
-
Creates a transport for
broker. It connects onconnect().
Properties
- broker → MemoryBroker
-
The broker this transport connects to.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
messages
→ Stream<
RawMessage> -
Messages that arrive on any subscribed filter.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → TransportState
-
The current connection state.
no setteroverride
-
states
→ Stream<
TransportState> -
Every change of state.
no setteroverride
-
subscriptions
→ Map<
String, Qos> -
The current filters and their QoS. Empty after a drop.
no setter
Methods
-
connect(
{RawMessage? lastWill}) → Future< void> -
Connects to the broker.
override
-
disconnect(
) → Future< void> -
Closes the connection on purpose. The last will is not published.
override
-
drop(
) → void - Simulates losing the network, as if the cable was pulled.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
publish(
RawMessage message) → Future< void> -
Sends
messageto the broker.override -
subscribe(
String filter, Qos qos) → Future< void> -
Starts receiving messages that match
filteron messages.override -
toString(
) → String -
A string representation of this object.
inherited
-
unsubscribe(
String filter) → Future< void> -
Stops receiving messages for
filter.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited