Options for opening a connection to a remote peer.

interface OpenConnectionOptions {
    force?: boolean;
    initiator?: boolean;
    onProgress?: ((evt) => void);
    priority?: number;
    signal?: AbortSignal;
}

Hierarchy (view full)

Properties

force?: boolean

When opening a connection to a remote peer, if a connection already exists it will be returned instead of creating a new connection. Pass true here to override that and dial a new connection anyway.

Default

false
initiator?: boolean

By default a newly opened outgoing connection operates in initiator mode during negotiation of encryption/muxing protocols using multistream-select.

In some cases such as when the dialer is trying to achieve TCP Simultaneous Connect using the DCUtR protocol, it may wish to act in responder mode, if so pass false here.

Default

true
onProgress?: ((evt) => void)

Type declaration

priority?: number

Connection requests with a higher priority will be executed before those with a lower priority.

Default

50
signal?: AbortSignal