Class CreateSendTransport

Creates a WebRTC send transport and sets up event handlers for the transport.

Supports both primary and local transports with modular handling.

The options for creating the send transport.

The type of transport to create.

The parameters required for creating the transport.

The level of the transport.

The member name for the transport.

The primary socket instance.

The device instance.

The primary producer transport object.

The state of the primary transport creation.

The function to update the primary transport object.

The function to update the primary transport creation state.

The function to connect the send transport.

The function to get updated parameters.

The local socket instance.

The local producer transport object.

The state of the local transport creation.

The function to update the local transport object.

The function to update the local transport creation state.

A promise that resolves when the send transport is created and configured.

Will throw an error if there is an issue creating the send transport.

const options = {
option: 'video',
parameters: {
islevel: '1',
member: 'John Doe',
socket: socketInstance,
localSocket: localSocketInstance,
device: deviceInstance,
producerTransport: null,
localProducerTransport: null,
transportCreated: false,
localTransportCreated: false,
updateProducerTransport: (transport) => console.log('Primary transport updated:', transport),
updateLocalProducerTransport: (transport) => console.log('Local transport updated:', transport),
updateTransportCreated: (state) => console.log('Primary transport created:', state),
updateLocalTransportCreated: (state) => console.log('Local transport created:', state),
},
};

createSendTransport(options)
.then(() => console.log('Send transport created successfully'))
.catch((error) => console.error('Error creating send transport:', error));

Constructors

Methods

Constructors

Methods

  • Creates a WebRTC send transport and sets up event handlers for the transport.

    Supports both primary and local transports with modular handling.

    Parameters

    Returns Promise<void>

    A promise that resolves when the send transport is created and configured.

    Will throw an error if there is an issue creating the send transport.

    const options = {
    option: 'video',
    parameters: {
    islevel: '1',
    member: 'John Doe',
    socket: socketInstance,
    localSocket: localSocketInstance,
    device: deviceInstance,
    producerTransport: null,
    localProducerTransport: null,
    transportCreated: false,
    localTransportCreated: false,
    updateProducerTransport: (transport) => console.log('Primary transport updated:', transport),
    updateLocalProducerTransport: (transport) => console.log('Local transport updated:', transport),
    updateTransportCreated: (state) => console.log('Primary transport created:', state),
    updateLocalTransportCreated: (state) => console.log('Local transport created:', state),
    },
    };

    createSendTransport(options)
    .then(() => console.log('Send transport created successfully'))
    .catch((error) => console.error('Error creating send transport:', error));