Interface StreamrClientConfig

Hierarchy

  • StreamrClientConfig

Properties

The Ethereum identity to be used by the client. Either a private key or a window.ethereum object.

cache?: {
    maxAge?: number;
    maxSize?: number;
}

Determines caching behaviour for certain repeated smart contract queries.

Type declaration

  • Optional maxAge?: number
  • Optional maxSize?: number
contracts?: {
    ethereumNetworks?: Record<string, EthereumNetworkConfig>;
    mainChainRPCs?: ChainConnectionInfo;
    maxConcurrentCalls?: number;
    storageNodeRegistryChainAddress?: string;
    streamRegistryChainAddress?: string;
    streamRegistryChainRPCs?: ChainConnectionInfo;
    streamStorageRegistryChainAddress?: string;
    theGraphUrl?: string;
}

The smart contract addresses and RPC urls to be used in the client. Generally not intended to be configured by the end-user unless a custom network is being formed.

Type declaration

  • Optional ethereumNetworks?: Record<string, EthereumNetworkConfig>
  • Optional mainChainRPCs?: ChainConnectionInfo
  • Optional maxConcurrentCalls?: number
  • Optional storageNodeRegistryChainAddress?: string
  • Optional streamRegistryChainAddress?: string
  • Optional streamRegistryChainRPCs?: ChainConnectionInfo
  • Optional streamStorageRegistryChainAddress?: string
  • Optional theGraphUrl?: string

    Some TheGraph instance, that indexes the streamr registries

encryption?: {
    keyRequestTimeout?: number;
    litProtocolEnabled?: boolean;
    litProtocolLogging?: boolean;
    maxKeyRequestsPerSecond?: number;
}

Controls how messages encryption and decryption should be handled and how encryption keys should be exchanged.

Type declaration

  • Optional keyRequestTimeout?: number

    When requesting an encryption key using the standard Streamr key-exchange system, defines how many milliseconds should a response be awaited for.

  • Optional litProtocolEnabled?: boolean

    Enable experimental Lit Protocol key exchange.

    When enabled encryption key storing and fetching will primarily be done through the Lit Protocol and secondarily through the standard Streamr key-exchange system.

  • Optional litProtocolLogging?: boolean

    Enable log messages of the Lit Protocol library to be printed to stdout.

  • Optional maxKeyRequestsPerSecond?: number

    The maximum amount of encryption key requests that should be sent via the standard Streamr key-exchange system per second.

    In streams with 1000+ publishers, it is important to limit the amount of control message traffic that gets generated to avoid network buffers from overflowing.

gapFill?: boolean

Set to true to enable gap filling.

Some messages may occasionally not reach the client due to networking issues. Missing messages form gaps that are often detectable and retrievable on demand. By enabling gap filling, the client will detect and fix gaps automatically for you.

gapFillTimeout?: number

When gap filling is enabled and a gap is encountered, this option defines the amount of time in milliseconds to wait before attempting to actively fill in the gap.

Rationale: data may just be arriving out-of-order and the missing message(s) may be on their way. For efficiency, it makes sense to wait a little before actively attempting to fill in a gap, as this involves a resend request / response interaction with a storage node.

id?: string

Custom human-readable debug id for client. Used in logging.

logLevel?: LogLevel

Override the default logging level.

maxGapRequests?: number

When gap filling is enabled, this option controls the maximum amount of times a gap will try to be actively filled before giving up and proceeding forwards.

metrics?: boolean | {
    maxPublishDelay?: number;
    periods?: {
        duration: number;
        streamId: string;
    }[];
}

Determines the telemetry metrics that are sent to the Streamr Network at regular intervals.

By setting this to false, you disable the feature.

network?: {
    acceptProxyConnections?: boolean;
    disconnectionWaitTime?: number;
    iceServers?: readonly IceServer[];
    id?: string;
    location?: Location;
    newWebrtcConnectionTimeout?: number;
    peerPingInterval?: number;
    rttUpdateTimeout?: number;
    trackerConnectionMaintenanceInterval?: number;
    trackerPingInterval?: number;
    trackers?: TrackerRegistryContract | TrackerRegistryRecord[];
    webrtcDatachannelBufferThresholdHigh?: number;
    webrtcDatachannelBufferThresholdLow?: number;
    webrtcDisallowPrivateAddresses?: boolean;
    webrtcMaxMessageSize?: number;
    webrtcPortRange?: WebRtcPortRange;
    webrtcSendBufferMaxMessageCount?: number;
}

These settings determine how the client performs and interacts with the Streamr Network.

Type declaration

  • Optional acceptProxyConnections?: boolean

    Whether to accept proxy connections. Enabling this option allows this network node to act as proxy on behalf of other nodes / clients.

  • Optional disconnectionWaitTime?: number

    Determines how long, in milliseconds, to keep non-relevant neighbor connections around for before disconnecting them.

    A connection with another node is relevant when the two share one or more streams and thus have messages to propagate to one another. When this no longer holds, the connection may be cut.

    During the topology re-organization process, sometimes a neighbor node may cease to be our neighbor only to become one once again in a short period of time. For this reason, it can be beneficial not to disconnect non-relevant neighbors right away.

  • Optional iceServers?: readonly IceServer[]

    The list of STUN and TURN servers to use in ICE protocol when forming WebRTC connections.

  • Optional id?: string

    The network-wide identifier of this node. Should be unique within the Streamr Network.

  • Optional location?: Location

    Defines an explicit geographic location for this node (overriding Geo IP lookup).

  • Optional newWebrtcConnectionTimeout?: number

    Defines WebRTC connection establishment timeout in milliseconds.

    When attempting to form a new connection, if not established within this timeout, the attempt is considered as failed and further waiting for it will cease.

  • Optional peerPingInterval?: number

    Defines how often, in milliseconds, to ping connected nodes to determine connection aliveness.

  • Optional rttUpdateTimeout?: number

    Determines how often, in milliseconds, at most, to include round-trip time (RTT) statistics in status updates to trackers.

  • Optional trackerConnectionMaintenanceInterval?: number

    Determines how often, in milliseconds, should tracker connections be maintained. This involves connecting to any relevant trackers to which a connection does not yet exist and disconnecting from irrelevant ones.

  • Optional trackerPingInterval?: number

    Defines how often, in milliseconds, to ping connected tracker(s) to determine connection aliveness.

  • Optional trackers?: TrackerRegistryContract | TrackerRegistryRecord[]

    Defines the trackers that should be used for peer discovery and connection forming.

    Generally not intended to be configured by the end-user unless a custom network is being formed.

  • Optional webrtcDatachannelBufferThresholdHigh?: number

    Sets the high-water mark used by send buffers of WebRTC connections.

  • Optional webrtcDatachannelBufferThresholdLow?: number

    Sets the low-water mark used by send buffers of WebRTC connections.

  • Optional webrtcDisallowPrivateAddresses?: boolean

    When set to true private addresses will not be probed when forming WebRTC connections.

    Probing private addresses can trigger false-positive incidents in some port scanning detection systems employed by web hosting providers. Disallowing private addresses may prevent direct connections from being formed between nodes using IPv4 addresses on a local network.

    Details: https://github.com/streamr-dev/network/wiki/WebRTC-private-addresses

  • Optional webrtcMaxMessageSize?: number

    The maximum outgoing message size (in bytes) accepted by WebRTC connections. Messages exceeding the maximum size are simply discarded.

  • Optional webrtcPortRange?: WebRtcPortRange

    Defines a custom UDP port range to be used for WebRTC connections. This port range should not be restricted by enclosing firewalls or virtual private cloud configurations.

  • Optional webrtcSendBufferMaxMessageCount?: number

    The maximum amount of messages retained in the send queue of a WebRTC connection.

    When the send queue becomes full, oldest messages are discarded first to make room for new.

orderMessages?: boolean

Due to the distributed nature of the network, messages may occasionally arrive to the client out-of-order. Set this option to true if you want the client to reorder received messages to the intended order.

retryResendAfter?: number

When gap filling is enabled and a gap is encountered, a resend request may eventually be sent to a storage node in an attempt to actively fill in the gap. This option controls how long to wait for, in milliseconds, for a resend response from the storage node before proceeding to the next attempt.

Generated using TypeDoc