mediasfu-reactnative-expo
Version:
mediasfu-reactnative-expo – Expo-managed React Native WebRTC SDK for video conferencing, webinars, live streaming, broadcast, screen sharing, whiteboard, chat, recording, live subtitles, translation, and AI agent rooms on iOS, Android, and web. Prebuilt r
31 lines (30 loc) • 1.25 kB
TypeScript
import { Socket } from 'socket.io-client';
import { Message } from '../@types/types';
export interface ReceiveRoomMessagesOptions {
socket: Socket;
roomName: string;
updateMessages: (messages: Message[]) => void;
}
export type ReceiveRoomMessagesType = (options: ReceiveRoomMessagesOptions) => Promise<void>;
/**
* Retrieves messages from a specified room and updates the message state.
*
* @param {ReceiveRoomMessagesOptions} options - The options for receiving room messages.
* @param {Socket} options.socket - The socket instance used for communication.
* @param {string} options.roomName - The name of the room from which to retrieve messages.
* @param {Function} options.updateMessages - Function to update the state with retrieved messages.
*
* @returns {Promise<void>} A promise that resolves when the messages have been retrieved and updated.
*
* @throws Will log an error message if there is an issue retrieving the messages.
*
* @example
* ```typescript
* await receiveRoomMessages({
* socket: socketInstance,
* roomName: 'Room1',
* updateMessages: (messages) => console.log(messages),
* });
* ```
*/
export declare const receiveRoomMessages: (options: ReceiveRoomMessagesOptions) => Promise<void>;