Joins a user to a room using socket communication with validation checks.
Contains:
socket: Socket instance for communication.
socket
roomName: Name of the room to join.
roomName
islevel: User's level indicator.
islevel
member: User identifier.
member
sec: Security token.
sec
apiUserName: API username for authentication.
apiUserName
Validation:
Response Handling:
Resolves with data from the 'joinRoom' event or rejects with validation errors.
Throws errors encountered during validation or join process.
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)); Copy
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));
Joins a user to a specified room via a socket connection.
The options for joining the room.
A promise that resolves with the data received from the 'joinRoom' event or rejects with a validation error.
Throws an error if the user is banned, suspended, or if the host has not joined the room yet.
Joins a user to a room using socket communication with validation checks.
Param: 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:
roomName
,apiUserName
, andmember
are alphanumeric.roomName
starts with 's' or 'p' and meets length requirements.sec
,islevel
, andapiUserName
against specified length and format conditions.Response Handling:
Returns
Resolves with data from the 'joinRoom' event or rejects with validation errors.
Throws
Throws errors encountered during validation or join process.
Example