MediaSFU Angular
    Preparing search index...

    Class SendMessage

    Sends a message to the specified room.

    This method validates the message and its recipients, checks user permissions, and then emits the message to the server via a socket connection. It also handles alerting the user for any errors encountered during the process, such as exceeding message limits or invalid input.

    The options for sending the message.

    The member sending the message.

    The level of the member.

    Function to show alert messages.

    List of co-host responsibilities.

    The co-host of the room.

    Chat setting for the room.

    The message to be sent.

    The name of the room.

    The current number of messages in the room.

    List of receivers for the message.

    Indicates if the message is for a group.

    The sender of the message.

    The socket instance for emitting events.

    A promise that resolves when the message is sent.

    Will throw an error if the message count limit is exceeded.

    Will throw an error if the message, sender, or receivers are not valid.

    Will throw an error if the user is not allowed to send a message in the event room.

    const sendMessageService = new SendMessage();
    await sendMessageService.sendMessage({
    member: 'JohnDoe',
    islevel: '1',
    showAlert: (alert) => console.log(alert.message),
    coHostResponsibility: [],
    coHost: 'JaneDoe',
    chatSetting: 'allowed',
    message: 'Hello everyone!',
    roomName: 'Room1',
    messagesLength: 50,
    receivers: ['user1', 'user2'],
    group: true,
    sender: 'JohnDoe',
    socket: socketInstance,
    });
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Sends a message to the specified room.

      Parameters

      • options: SendMessageOptions

        The options for sending the message.

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

      Returns Promise<void>

      A promise that resolves when the message is sent.

      Will throw an error if the message count limit is exceeded.

      Will throw an error if the message, sender, or receivers are not valid.

      Will throw an error if the user is not allowed to send a message in the event room.