• Public
  • Public/Protected
  • All

A configuration object specifying which network transports Ditto should use to sync data.

A Ditto object comes with a default transport configuration where all available peer-to-peer transports are enabled. You can customize this by copying that or initializing a new TransportConfig, adjusting its properties, and supplying it to setTransportConfig() on Ditto.

When you initialize a new TransportConfig instance, all transports are disabled. You must enable each one explicitly.

Peer-to-peer transports will automatically discover peers in the vicinity and create connections without any configuration. These are configured via the peerToPeer property. To turn each one on, set its isEnabled property to true.

To connect to a peer at a known location, such as a Ditto Big Peer, add its address inside the connect configuration. These are either "host:port" strings for raw TCP sync, or a "wss://…" URL for websockets.

The listen configurations are for specific less common data sync scenarios. Please read the documentation on the Ditto website for examples. Incorrect use of listen can result in insecure configurations.

IMPORTANT: when running in the browser, only the connect.websocketURLs part is considered, the rest of the configuration is ignored.


  • TransportConfig




  • Create a new transport config initialized with the default settings.

    Returns TransportConfig


Readonly connect

Configuration for connecting to servers.

Readonly global

Settings not associated with any specific type of transport.

Readonly isFrozen

isFrozen: boolean

Returns true if the transport configuration is frozen, otherwise returns false.

Readonly listen

Configuration for listening for incomping connections.

Readonly peerToPeer

Configuration for peer-to-peer connections.




  • (Deep) freezes the receiver such that it can't be modified anymore.

    Returns TransportConfig


  • setAllPeerToPeerEnabled(enabled: boolean): void
  • Enables all peer-to-peer transports. Throws if receiver is frozen.


    • enabled: boolean

    Returns void

Static areListenHTTPsEqual

Static areListenTCPsEqual