Skip to main content

MessageEvent<T>

type MessageEvent<T> = object;

A MessageEvent represents a single message along with metadata about the message.

Remember to import MessageEvent from @foxglove/extension. This is not the same as the DOM MessageEvent class.

Type Parameters

Type ParameterDefault type
Tunknown

Properties

topic

topic: string;

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


schemaName

schemaName: string;

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


receiveTime

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.


publishTime?

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.


message

message: T;

The deserialized message as a JavaScript object.


sizeInBytes

sizeInBytes: number;

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


originalMessageEvent?

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.