To retrieve your SDK connection details ensure you have first:

  1. Created A Ditto Portal Account - Creating a Ditto Account
  2. Created A Ditto App - Creating a New App

After you’ve created your app, select it from the list.

On the Connect tab, you will see the following details under Big peer connection information:

  • App ID - The unique identifier for your app.
  • Auth URL - This is the URL you will need to pass to your SDK to authenticate.
  • Websocket URL - This is the URL you will need to pass to your SDK to initiate replication via Websocket to the Big Peer.

On the Connect tab, under Authentication Mode, if you are still using the default authentication settings, you will also see the Online Playground Authentication Token. This token is used to authenticate your SDK to the Big Peer. It allows you to explore Ditto platform features and functionality without the hassle of setting up your own authentication mechanism.

Connecting an SDK

Below are some examples of how to connect an SDK to the Big Peer:

ditto = Ditto(
  identity: DittoIdentity.onlinePlayground(
    appID: "REPLACE_ME_WITH_YOUR_APP_ID",
    token: "REPLACE_ME_WITH_YOUR_PLAYGROUND_TOKEN",
    enableDittoCloudSync: false, // This is required to be set to false to use the correct URLs
    customAuthURL: URL(string: "REPLACE_ME_WITH_YOUR_AUTH_URL")
  )
)

// Set the Ditto Websocket URL
var config = DittoTransportConfig()
config.connect.webSocketURLs.insert("wss://REPLACE_ME_WITH_YOUR_WEBSOCKET_URL")

// Optionally enable all P2P transports if using P2P Sync
// Do not call this if only using Ditto Cloud Sync
config.enableAllPeerToPeer()

ditto.transportConfig = config

do {
  try ditto.startSync()
} catch (let err) {
  print(err.localizedDescription)
}