Type alias MessageEvent<T>

MessageEvent<T>: {
    message: T;
    originalMessageEvent?: MessageEvent;
    publishTime?: Time;
    receiveTime: Time;
    schemaName: string;
    sizeInBytes: number;
    topic: string;
}

A message event frames message data with the topic and receive time

Type Parameters

  • T = unknown

Type declaration

  • message: T

    The deserialized message as a JavaScript object.

  • Optional originalMessageEvent?: MessageEvent

    When subscribing to a topic using the convertTo option, the message event message contains the converted message and the originalMessageEvent field contains the original un-converted message event.

  • Optional publishTime?: Time

    The time in nanoseconds this message was originally published. This is only available for some data sources. The timestamp is often nanoseconds since the UNIX epoch, but may be relative to another event such as system boot time or simulation start time depending on the context.

  • receiveTime: Time

    The time in nanoseconds this message was received. This may be set by the local system clock or the data source, depending on the data source used and whether time is simulated via a /clock topic or similar mechanism. The timestamp is often nanoseconds since the UNIX epoch, but may be relative to another event such as system boot time or simulation start time depending on the context.

  • schemaName: string

    The schema name is an identifier for the schema of the message within the message event.

  • sizeInBytes: number

    The approximate size of this message in its serialized form. This can be useful for statistics tracking and cache eviction.

  • topic: string

    The topic name this message was received on, i.e. "/some/topic"