MediaSFU Shared
    Preparing search index...

    Function sendMessage

    • Sends a message to the server.

      Parameters

      • options: SendMessageOptions

        The options for sending a message.

        • message: string
        • receivers: string[]
        • group: boolean
        • messagesLength: number
        • member: string
        • sender: string
        • islevel: string
        • OptionaleventType?: EventType
        • OptionalshowAlert?: ShowAlert
        • coHostResponsibility: CoHostResponsibility[]
        • coHost: string
        • roomName: string
        • socket: Socket
        • chatSetting: string

      Returns Promise<void>

      A promise that resolves when the message is sent.

      Will show an alert if the message count exceeds the limit, if the message is invalid, or if the user is not allowed to send a message.

      await sendMessage({
      message: "Hello, World!",
      receivers: ["user1", "user2"],
      group: true,
      messagesLength: 50,
      member: "user3",
      sender: "user3",
      islevel: "2",
      eventType: "chat",
      showAlert: ({ message, type }) => console.log(message, type),
      coHostResponsibility: [{ name: "chat", value: true }],
      coHost: "coHostUser",
      roomName: "mainRoom",
      socket: socketInstance,
      chatSetting: "allow",
      });