Inbox

interface inbox.Inbox

Message inbox.

Receives messages. Delivers received messages. Delivery order implementation dependent.

inbox.Inbox.add(message)

Add message to inbox.

Arguments:
  • message (*) – Message to add.
inbox.Inbox.receive()

Receive message from inbox.

Removes received message.

Throws:EmptyError – If the inbox is empty.
Returns:* – The next message.
inbox.Inbox.watch(timeout=null)

Watch for message in inbox.

If nonempty returns next message immediately. If empty waits for next add and returns added message. Optionally watch for limited time. Removes returned message.

Arguments:
  • timeout (number) – Maximum time to wait in milliseconds. null to wait forever.
Throws:
  • BusyError – If another watch operation is running.
  • TimeoutError – If timeout expires before message arrives.
Returns:

* – The next message.