Service for receiving and processing messages, including handling group and direct messages, filtering banned senders, and updating message states.
ReceiveMessage
Manages incoming messages, appends them to the existing messages array, filters out banned senders, and updates message badge visibility as needed.
receiveMessage
Options for handling a received message:
message
messages
participantsAll
member
eventType
islevel
coHost
updateMessages
updateShowMessagesBadge
Resolves when the message processing and updates are complete.
const message = { sender: 'Alice', receivers: ['Bob'], message: 'Hello!', timestamp: Date.now(), group: false };const options = { message, messages: [], participantsAll: [{ name: 'Alice' }, { name: 'Bob' }], member: 'Bob', eventType: 'chat', islevel: '1', coHost: 'Charlie', updateMessages: (updatedMessages) => console.log('Messages updated:', updatedMessages), updateShowMessagesBadge: (show) => console.log('Show badge:', show)};receiveMessageService.receiveMessage(options); Copy
const message = { sender: 'Alice', receivers: ['Bob'], message: 'Hello!', timestamp: Date.now(), group: false };const options = { message, messages: [], participantsAll: [{ name: 'Alice' }, { name: 'Bob' }], member: 'Bob', eventType: 'chat', islevel: '1', coHost: 'Charlie', updateMessages: (updatedMessages) => console.log('Messages updated:', updatedMessages), updateShowMessagesBadge: (show) => console.log('Show badge:', show)};receiveMessageService.receiveMessage(options);
Receives and processes a message, updating the messages array and handling various message types and events.
The options for receiving the message.
A promise that resolves when the message has been processed.
Service for receiving and processing messages, including handling group and direct messages, filtering banned senders, and updating message states.
Name
ReceiveMessage
Description
Manages incoming messages, appends them to the existing messages array, filters out banned senders, and updates message badge visibility as needed.
Method
receiveMessage
Param: options
Options for handling a received message:
message
{Message}: The new message object to process.messages
{Message[]}: The current list of messages.participantsAll
{Participant[]}: All participants in the chat.member
{string}: The current member's name.eventType
{EventType}: The type of event (e.g., "broadcast" or "chat").islevel
{string}: The level of the current user.coHost
{string}: The name of the co-host.updateMessages
{Function}: A function to update the messages list.updateShowMessagesBadge
{Function}: A function to toggle the visibility of the message badge.Returns
Resolves when the message processing and updates are complete.
Example