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.
Param: options
The options for sending the message.
Param: options.member
The member sending the message.
Param: options.islevel
The level of the member.
Param: options.showAlert
Function to show alert messages.
Param: options.coHostResponsibility
List of co-host responsibilities.
Param: options.coHost
The co-host of the room.
Param: options.chatSetting
Chat setting for the room.
Param: options.message
The message to be sent.
Param: options.roomName
The name of the room.
Param: options.messagesLength
The current number of messages in the room.
Param: options.receivers
List of receivers for the message.
Param: options.group
Indicates if the message is for a group.
Param: options.sender
The sender of the message.
Param: options.socket
The socket instance for emitting events.
Returns
A promise that resolves when the message is sent.
Throws
Will throw an error if the message count limit is exceeded.
Throws
Will throw an error if the message, sender, or receivers are not valid.
Throws
Will throw an error if the user is not allowed to send a message in the event room.
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.
Param: options
The options for sending the message.
Param: options.member
The member sending the message.
Param: options.islevel
The level of the member.
Param: options.showAlert
Function to show alert messages.
Param: options.coHostResponsibility
List of co-host responsibilities.
Param: options.coHost
The co-host of the room.
Param: options.chatSetting
Chat setting for the room.
Param: options.roomName
The name of the room.
Param: options.receivers
List of receivers for the message.
Param: options.group
Indicates if the message is for a group.
Param: options.sender
The sender of the message.
Param: options.socket
The socket instance for emitting events.
Returns
A promise that resolves when the message is sent.
Throws
Will throw an error if the message count limit is exceeded.
Throws
Will throw an error if the message, sender, or receivers are not valid.
Throws
Will throw an error if the user is not allowed to send a message in the event room.
Example