Connects to remote IPs and manages socket connections.

This method establishes connections to remote IPs for media streaming, handles new pipe producer events, and manages producer closure events. It updates the necessary state in the application to reflect the current connections and stream configurations.

The options for connecting IPs.

The array of current socket connections.

The list of remote IPs to connect to.

The API username for authentication.

The API key for authentication.

The API token for authentication.

The method to handle new pipe producer events (default: newPipeProducer).

The method to handle producer closed events (default: producerClosed).

The method to handle joining a consuming room (default: joinConsumeRoom).

Additional parameters for the operation.

The list of IPs that have been received in the room.

Function to update the room received IPs.

Function to update the consume sockets.

A promise that resolves to an array containing the updated consume sockets and room received IPs.

Will throw an error if required parameters are missing or if there is an issue connecting to a remote IP.

const result = await connectIps({
consume_sockets: currentSockets,
remIP: ['192.168.1.1', '192.168.1.2'],
apiUserName: 'username',
apiKey: 'your-api-key',
apiToken: 'your-api-token',
parameters: {
roomRecvIPs: [],
updateRoomRecvIPs: (ips) => { },
updateConsume_sockets: (sockets) => { },
// ...other parameters
},
});

Constructors

Methods

Constructors

Methods

  • Connects to remote IPs and manages socket connections.

    Parameters

    Returns Promise<any>

    A promise that resolves to an array containing the updated consume sockets and room received IPs.

    Will throw an error if required parameters are missing or if there is an issue connecting to a remote IP.