A chat message delivered to or sent from the room.

Example

import { onMessage } from "@urth/metatell-sdk/chat";

onMessage((m) => {
console.log(`${m.from.displayName}: ${m.text}`);
});

Hierarchy

  • ChatMessage

Properties

channel: "global" | "group"

Channel the message belongs to.

from: {
    displayName: string;
    sessionId: string;
}

The sender's session id and display name.

Type declaration

  • displayName: string
  • sessionId: string
groupId?: string

Group id, set only when channel is "group".

id: string

Unique id of the message.

mentions: Mention[]

Mentions parsed from text.

replyTo?: string

Id of the message this one replies to, if it is a reply.

sentAt: number

Send time as a Unix timestamp in milliseconds.

text: string

The raw message text, including any mention markup.