mediasfu-reactjs
Version:
MediaSFU Prebuilt ReactJS SDK - Compatible with React 18 & 19, TypeScript & JavaScript
52 lines • 2.52 kB
TypeScript
import { ReorderStreamsParameters, ReorderStreamsType, NewPipeProducerParameters, NewPipeProducerType, ProducerClosedType, ProducerClosedParameters, ReceiveAllPipedTransportsParameters, ReceiveAllPipedTransportsType } from '../@types/types';
import { Socket } from "socket.io-client";
export interface ConnectLocalIpsParameters extends ReorderStreamsParameters, ProducerClosedParameters, NewPipeProducerParameters, ReceiveAllPipedTransportsParameters {
socket: Socket;
reorderStreams: ReorderStreamsType;
receiveAllPipedTransports: ReceiveAllPipedTransportsType;
getUpdatedAllParams: () => ConnectLocalIpsParameters;
[key: string]: any;
}
export interface ConnectLocalIpsOptions {
socket: Socket;
newProducerMethod?: NewPipeProducerType;
closedProducerMethod?: ProducerClosedType;
parameters: ConnectLocalIpsParameters;
}
export type ConnectLocalIpsType = (options: ConnectLocalIpsOptions) => Promise<void>;
/**
* Connects to remote IPs and manages socket connections.
*
* @param {ConnectLocalIpsOptions} options - The options for connecting IPs.
* @param {Socket} options.socket - The socket to connect to.
* @param {Function} [options.newProducerMethod=newPipeProducer] - The method to handle new pipe producer events.
* @param {Function} [options.closedProducerMethod=producerClosed] - The method to handle producer closed events.
* @param {ConnectLocalIpsParameters} options.parameters - Additional parameters.
* @param {Function} options.parameters.reorderStreams - The function to reorder streams.
* @param {Function} options.parameters.getUpdatedAllParams - The function to get updated parameters.
* @param {Socket} options.parameters.socket - The socket to connect to.
*
* @returns {Promise<void>} A promise that resolves when the connection is established.
*
* @throws Will throw an error if required parameters are missing or if there is an issue connecting to a remote IP.
*
* @example
* ```typescript
* const options = {
* socket,
* newProducerMethod: newPipeProducer,
* closedProducerMethod: producerClosed,
* parameters: connectLocalIpsParameters,
* };
*
* connectLocalIps(options)
* .then(() => {
* console.log('Connected to local IPs');
* })
* .catch(error => {
* console.error('Error connecting to local IPs:', error);
* });
* ```
*/
export declare const connectLocalIps: ({ socket, newProducerMethod, closedProducerMethod, parameters, }: ConnectLocalIpsOptions) => Promise<void>;
//# sourceMappingURL=connectLocalIps.d.ts.map