IMessageReceiver class

Callback interface to receive incoming messages.

Example

class MyMessageReceiver implements IMessageReceiver {
  Future receiveMessage(MessageEnvelop envelope, IMessageQueue queue) async {
      print("Received message: " + envelop.getMessageAsString());
  }
}

var messageQueue =  MemoryMessageQueue();
messageQueue.listen("123", MyMessageReceiver());

await messageQueue.open("123")

messageQueue.send("123", MessageEnvelop(null, "mymessage", "ABC")); // Output in console: "ABC"

Constructors

IMessageReceiver()

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

receiveMessage(MessageEnvelope envelope, IMessageQueue queue) → Future
Receives incoming message from the queue. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited