mediasfu-angular
Version:
mediasfu-angular - Angular 17/18/19 WebRTC SDK for video conferencing, webinars, broadcasts, live streaming, chat, recording, whiteboard, and AI agents. Prebuilt rooms and fully custom UIs.
55 lines (54 loc) • 2.13 kB
TypeScript
import { Socket } from 'socket.io-client';
import * as i0 from "@angular/core";
export interface JoinRoomOptions {
socket: Socket;
roomName: string;
islevel: string;
member: string;
sec: string;
apiUserName: string;
}
export type JoinRoomType = (socket: Socket, roomName: string, islevel: string, member: string, sec: string, apiUserName: string) => Promise<object>;
/**
* Joins a user to a room using socket communication with validation checks.
*
* @param {JoinRoomOptions} options - Contains:
* - `socket`: Socket instance for communication.
* - `roomName`: Name of the room to join.
* - `islevel`: User's level indicator.
* - `member`: User identifier.
* - `sec`: Security token.
* - `apiUserName`: API username for authentication.
*
* - **Validation**:
* - Ensures `roomName`, `apiUserName`, and `member` are alphanumeric.
* - Verifies that `roomName` starts with 's' or 'p' and meets length requirements.
* - Validates `sec`, `islevel`, and `apiUserName` against specified length and format conditions.
*
* - **Response Handling**:
* - Resolves with the server's response upon a successful join.
* - Rejects with a descriptive error if the user is banned, suspended, or if the host has not yet joined the room.
*
* @returns {Promise<object>} Resolves with data from the 'joinRoom' event or rejects with validation errors.
* @throws {Error} Throws errors encountered during validation or join process.
*
* @example
* ```typescript
* const joinOptions = {
* socket: mySocket,
* roomName: 'sMyRoom',
* islevel: '1',
* member: 'participant123',
* sec: '64-character-secure-key...',
* apiUserName: 'apiUser123',
* };
* joinRoom(joinOptions)
* .then(response => console.log('Room joined:', response))
* .catch(error => console.error('Join failed:', error));
* ```
*/
export declare class JoinRoom {
joinRoom({ socket, roomName, islevel, member, sec, apiUserName, }: JoinRoomOptions): Promise<object>;
static ɵfac: i0.ɵɵFactoryDeclaration<JoinRoom, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<JoinRoom>;
}