ConnectionListener class
Classes that implements this can listen and get notified when there's a connection/disconnection on any device as well as message received.
The Server does not guarantee that onConnected will only be fired once for every device. It can be fired multiple times based on connection and disconnection.
Constructors
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
onConnected(
Device device) → void -
When a new socket connection is received, this method will be called.
This method can be called multiple times for a discovered device if the
device disconnects and reconnects.
device
contains information on the Device. -
onDisconnected(
Device device, bool isError, Object error, StackTrace stackTrace) → void -
When the socket connection closes either normally or due to an error,
this method is called. If the connection closed without error,
isError
will be false. If an error occurred, you can retrieve the error usingerror
.stackTrace
may be null is the error provider does not send one.device
contains the object to the Device that was disconnected. Ifdevice
is null, this means that the Host was unable to start the socket. -
onMessage(
Packet packet, Device device) → void -
When a message is received from a
device
, this method is called with the received message as a Packet -
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited