ChatInstance

Implementation of a single chat instance

Constructors

Properties

beginChat: () => Promise<void> & ISingleshotClearable

Begins a chat session

callbacks: Partial<IChatInstanceCallbacks>
clientId: string
onDispose: DisposeFn
payload: Payload
swarmName: string

Methods

  • Checks if the chat has been active within the timeout period

    Parameters

    • now: number

      Current timestamp

    Returns Promise<boolean>

    Whether the chat is still active

  • Disposes of the chat instance

    Returns Promise<void>

  • Adds a listener for dispose events

    Parameters

    • fn: (clientId: string) => void

      Callback function to execute on dispose

    Returns () => void

  • Sends a message in the chat

    Parameters

    • content: string

      Message content to send

    Returns Promise<string>

    Response from the chat session