Type alias BroadcastMessage

BroadcastMessage: {
    channel: string;
    data: any;
    from: UserInfo;
}

Represents a message broadcast through the realtime system.

BroadcastMessages are sent via channels (usually the postId) to all subscribed players.

Type declaration

  • channel: string

    The channel this message was sent on Typically this is the postId, but you can create your own channels

  • data: any

    The payload of the message Can be any serializable data

  • from: UserInfo

    The user who sent the message

Example

const message: BroadcastMessage = {
from: userInfo,
channel: "t3_abc123",
data: { type: "MOVE", playerId: "t2_xyz789", position: { x: 100, y: 200 } }
};