Skip to content

Module Message Delivery Events

Delivery events send transient module output to an active platform session. They do not create a persisted platform notification and do not confirm that a client received or displayed the message.

delivery.account.send

Sends a message to active sessions whose current account login equals target.id. The current server implementation routes the formatted message through WebSocket.

Event data

{
  "event_id": "0192f7d7-8bd5-7e1a-b6cb-0f1e37d1ad11",
  "schema_version": 1,
  "created_at": 1789080000,
  "target": {
    "id": 10001
  },
  "message": {
    "type": "ai.run.delta",
    "payload": {
      "run_id": "run-123",
      "delta": "Generated text"
    }
  }
}

target.id is the account login. If several active sessions use that login, the platform may deliver the message to all matching sessions.

delivery.manager.send

Sends a message to active sessions belonging to the manager whose ID equals target.id. The current server implementation routes the formatted message through the manager TCP transport.

Event data

{
  "event_id": "0192f7d7-8bd5-7e1a-b6cb-0f1e37d1ad11",
  "schema_version": 1,
  "created_at": 1789080000,
  "target": {
    "id": 42
  },
  "message": {
    "type": "ai.run.completed",
    "payload": {
      "run_id": "run-123",
      "status": "completed"
    }
  }
}

target.id is the platform manager ID. If the manager has several active sessions, the platform may deliver the message to all matching sessions.

Publishing with Moleculer

The event name is the public contract. The event data is the object shown above; the Moleculer transporter adds its own protocol envelope.

Conceptual JavaScript example:

broker.emit("delivery.account.send", {
  event_id: crypto.randomUUID(),
  schema_version: 1,
  created_at: Math.floor(Date.now() / 1000),
  target: { id: 10001 },
  message: {
    type: "ai.run.delta",
    payload: {
      run_id: "run-123",
      delta: "Generated text"
    }
  }
});

Behaviour and limits

  • Maximum event data size: 256 KiB.
  • message.payload must be a JSON object.
  • The handler performs no database persistence.
  • No response is returned to the module.
  • Internal handler success means validation completed and the platform send method was invoked.
  • It does not prove that the transport accepted the message, a matching session existed or the client received the data.
  • Delivery to offline recipients is not queued by this contract.
  • For durable user-visible notifications, use a dedicated action rather than these events.

Extending message types

message.type identifies the application message, not the publishing module. Examples include ai.run.delta and ai.run.completed. Adding a type does not require a new platform listener if the common client envelope remains sufficient.

A new listener is required only when addressing, validation, execution policy or platform behaviour differs from the existing delivery contracts.