libp2p
    Preparing search index...

    Interface StreamMuxerOptions<MuxedStreamOptions>

    User-facing message stream muxer options

    interface StreamMuxerOptions<
        MuxedStreamOptions extends StreamOptions = StreamOptions,
    > {
        maxEarlyStreams?: number;
        maxInboundStreams?: number;
        maxMessageSize?: number;
        maxOutboundStreams?: number;
        streamOptions?: MuxedStreamOptions;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index

    Properties

    maxEarlyStreams?: number

    libp2p is notified of incoming streams via the muxer's 'stream' event.

    During connection establishment there may be a small window where a muxer starts to process incoming stream data before a listener has been added for the 'stream' event.

    If no handler is registered for this event incoming streams can be missed so when this is the case muxers queue streams internally as "early streams", and will defer emitting the 'stream' event until after a listener has been registered.

    Allowing an unlimited amount of early streams can cause excessive memory consumption so this setting controls how many early streams to store when no 'stream' listener has been registered.

    If more streams than this are opened before a listener is added the muxed connection will be reset.

    10
    
    maxInboundStreams?: number

    Maximum number of concurrent inbound streams that we accept - if the peer tries to open more streams, those will be reset immediately

    1_000
    
    maxMessageSize?: number

    Maximum size of a message in bytes that we'll send on a stream - this ensures that a single stream doesn't hog a connection

    65_536
    
    maxOutboundStreams?: number

    Maximum number of concurrent outbound streams that we accept - if the application tries to open more streams, the call to newStream will throw

    1_000
    
    streamOptions?: MuxedStreamOptions

    Configuration options for each outgoing/incoming stream