libp2p
    Preparing search index...

    Class AbstractMultiaddrConnectionAbstract

    A MultiaddrConnection is returned by a transport after dialing a peer. It is a low-level primitive and is the raw connection, typically without encryption or stream multiplexing.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    Whether this stream is inbound or outbound

    inactivityTimeout: number

    If no data is transmitted over the stream in this many ms, the stream will be aborted with an InactivityTimeoutError

    log: Logger

    A logging implementation that can be used to log stream-specific messages

    maxMessageSize?: number
    maxReadBufferLength: number

    The maximum number of bytes to store when paused. If receipt of more bytes from the remote end of the stream causes the buffer size to exceed this value the stream will be reset and a 'close' event emitted.

    This value can be changed at runtime.

    maxWriteBufferLength?: number

    When the .send method returns false it means that the underlying resource has signalled that it's write buffer is full. If the user continues to call .send, outgoing bytes are stored in an internal buffer until the underlying resource signals that it can accept more data.

    If the size of that internal buffer exceed this value the stream will be reset and a 'close' event emitted.

    This value can be changed at runtime.

    readBuffer: Uint8ArrayList

    Any data stored here is emitted before any new incoming data.

    This is used when the stream is paused or if data is pushed onto the stream

    remoteAddr: Multiaddr

    The address of the remote end of the connection

    remoteReadStatus: MessageStreamReadStatus
    remoteWriteStatus: MessageStreamWriteStatus
    sendingData: boolean

    The current status of the message stream

    Timestamps of when stream events occurred

    writableNeedsDrain: boolean

    If this property is true, the underlying transport has signalled that its write buffer is full and that .send should not be called again.

    A drain event will be emitted after which is its safe to call .send again to resume sending.

    writeBuffer: Uint8ArrayList

    Accessors

    Methods

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      Returns boolean

    • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().

      MDN Reference

      Parameters

      Returns boolean

    • Send a data message to the remote end of the stream. Implementations of this method should return the number of bytes from the passed buffer that were sent successfully and if the underlying resource can accept more data.

      The implementation should always attempt to send the maximum amount of data possible.

      Returning a result that means the data was only partially sent but that the underlying resource can accept more data is invalid.

      Parameters

      Returns SendResult