Channel Namespace
ChannelMessage interface
Every message delivered to a subscribe callback is wrapped in a ChannelMessage<D> envelope.
Definition
export interface ChannelMessage<D = ChannelMessageData> {
address: {
boundary: string; // Scope boundary of the address (e.g. 'WORLD')
category: string; // Push category of the address (e.g. 'RUN')
key: string; // Scope key for the address
};
sender: {
type: string; // Sender type, e.g. 'USER' or 'SYSTEM'
key: string; // Sender key
};
content: D; // The published payload
date: string; // ISO 8601 timestamp of when the message was sent
type: string; // Message type/category
}
Properties
address.boundary: The scope boundary of the address (e.g.WORLD).address.category: The push category of the address (e.g.RUN).address.key: The scope key for the address (e.g. your world key when boundary isWORLD).sender.type: The sender type — typicallyUSERorSYSTEM.sender.key: The unique key identifying the sender.content: The published payload, typed asD.date: An ISO 8601 timestamp string for when the message was sent.type: The message type/category.
ChannelScope interface
The ChannelScope interface describes the scope of a push channel. It extends the GenericScope interface.
Properties
- Inherits all properties of
GenericScope. pushCategory (string): Identifies the channel type. For details, seePUSH_CATEGORYenum.
ChannelMessageData type
Default type for the content field of ChannelMessage interface.
Override by passing a type argument to Channel<MyType> class to get end-to-end typing on both publish and subscribe.
Definition
export type ChannelMessageData = unknown;
Channel class
Implements push channels in Epicenter using CometD.
learn more
For a detailed description of the class and its methods, read Channel class.