/**
 * This helps to trigger Message read
 * @param {string} roomId - active roomID
 * @param {string} userId - userId who sending the message
 * @param {string} message - the latest message
 */
export function messageReadEvent(
  roomId?: string,
  userId?: string | number,
  message?: string,
  message_type?: string | number | null,
  request_status?: string,
  lastMessageId?: string | number,
  chatLength?: string | number
) {
  if ((window as any)?.Echo) {
    (window as any).Echo?.private(`chat.${roomId}`).whisper("MessageRead", {
      roomId: roomId,
      userId: userId,
      message: message,
      message_type: message_type,
      request_status,
      lastMessageId,
      chatLength,
    });
  }
}
