Ditto 4.4.3
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ditto::TransportConfig Class Reference

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

#include <TransportConfig.hpp>

Public Member Functions

void enable_all_peer_to_peer ()
 
bool operator== (const TransportConfig &other) const
 
bool operator!= (const TransportConfig &other) const
 

Public Attributes

PeerToPeer peer_to_peer
 
Connect connect
 
Listen listen
 
Global global
 

Detailed Description

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 initializing a TransportConfig, adjusting its properties, and supplying it to Ditto::set_transport_config().

When you initialize a TransportConfig yourself it starts with all transports disabled. You must enable each one directly.

Peer-to-peer transports will automatically discover peers in the vicinity and create connections without any configuration. These are configured inside the `peer_to_peer` property. To turn each one on, set its enabled 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.

The `global` configurations are not for any specific type of transport. instead it is used for sync_group and other global parameter configurations.

Member Function Documentation

◆ enable_all_peer_to_peer()

void ditto::TransportConfig::enable_all_peer_to_peer ( )
inline

Set all available peer-to-peer transports to be enabled.

Member Data Documentation

◆ connect

Connect ditto::TransportConfig::connect

Configuration for connections to specific remote peers.

◆ global

Global ditto::TransportConfig::global

Settings not associated with any specific type of transport.

◆ listen

Listen ditto::TransportConfig::listen

Configuration for receiving incoming connections.

◆ peer_to_peer

PeerToPeer ditto::TransportConfig::peer_to_peer

Configuration relating to peer-to-peer transports, which creates connections automatically.