Skip to content

Drop redundant transport config from java-server quickstart#291

Merged
Brian Plattenburg (bplattenburg) merged 1 commit into
mainfrom
bp/cleanup-java-server-transport-config
May 28, 2026
Merged

Drop redundant transport config from java-server quickstart#291
Brian Plattenburg (bplattenburg) merged 1 commit into
mainfrom
bp/cleanup-java-server-transport-config

Conversation

@bplattenburg
Copy link
Copy Markdown
Member

@bplattenburg Brian Plattenburg (bplattenburg) commented May 27, 2026

v5's serverConnect(endpoint) already wires the cloud-sync transport from the URL it's given, so the connect().websocketUrls().add(...) block is v4 leftover. The peerToPeer() block re-enables BLE and LAN, which v5 turns on by default, and BLE has no business on a server peer anyway.

Canonical v5 init doesn't include updateTransportConfig at all: https://docs.ditto.live/sdk/latest/install-guides/java/server

Leaving DITTO_WEBSOCKET_URL in .env.sample since other quickstarts still reference it. Cross-app audit to follow.

The v5 Java SDK derives the cloud-sync transport from the URL passed to
DittoConfig.Builder.serverConnect(...). The explicit
config.connect().websocketUrls().add(...) call was a v4-era leftover and
is no longer needed.

The config.peerToPeer() block re-enabled BLE and LAN, which are SDK
defaults in v5. LAN with mDNS is already on. Re-enabling BLE on a server
peer is wrong: headless hosts have no Bluetooth radio, so the call is
either dead weight or a likely source of hangs/exceptions inside the
transport-config lambda.

Per the canonical v5 init at
https://docs.ditto.live/sdk/latest/install-guides/java/server,
updateTransportConfig is not part of the standard server initialization.
Removing both blocks lets the SDK use its defaults.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR simplifies the Java server quickstart’s Ditto initialization by relying on the v5 serverConnect(...) transport defaults instead of manually mutating transport configuration.

Changes:

  • Removes the explicit WebSocket URL transport configuration.
  • Removes explicit BLE and LAN peer-to-peer transport toggles.
  • Removes startup logging of the transport config block that no longer exists.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bplattenburg Brian Plattenburg (bplattenburg) merged commit 83be232 into main May 28, 2026
7 of 9 checks passed
@bplattenburg Brian Plattenburg (bplattenburg) deleted the bp/cleanup-java-server-transport-config branch May 28, 2026 00:19
Brian Plattenburg (bplattenburg) added a commit that referenced this pull request May 28, 2026
Brings the Android Kotlin (#239), React Native (#267), and Rust TUI
(#242) v5 migrations into the offline branch, and re-applies the
DITTO_OFFLINE_LICENSE_TOKEN switch on top of each migrated app's new
v5 init code per docs/offline-mode-followup-for-v5-migration-prs.md.

Also pulls in PR #291 (java-server transport-config cleanup), which is
a no-op here since the offline branch already removed the same block in
commit 0231678.

Per-app notes:

- android-kotlin/TasksApplication.kt: rewritten on top of Aaron's v5
  init using DittoConfig + DittoHandler.initialize(...). Drops the
  v4-only updateTransportConfig websocket block since v5's
  serverConnect() handles it. Removes DITTO_WEBSOCKET_URL from
  BuildConfig and the env-vars required-for-online check.

- react-native/App.tsx: drops the explicit websocketURLs transport
  config (v4 leftover); the offline switch wraps the existing
  setExpirationHandler block from #267 with the offline-mode guard.
  env.d.ts loses DITTO_WEBSOCKET_URL, keeps DITTO_OFFLINE_LICENSE_TOKEN.

- react-native-expo/types/env.d.ts: keeps both DITTO_WEBSOCKET_URL and
  DITTO_OFFLINE_LICENSE_TOKEN — expo isn't migrated to v5 yet, so the
  existing transport-config block in App.tsx still references the URL.

- rust-tui/src/bin/main.rs: rewritten on top of Aaron's v5 init using
  DittoConfig::new + DittoConfigConnect::{Server, SmallPeersOnly}.
  Drops websocket_url from try_init_ditto entirely (no longer needed
  for v5 server connect). The websocket_url Cli arg stays because
  TuiTask still displays it.

Flutter #237 is still open upstream, so the flutter_app changes from the
offline branch remain on the v4 SDK path until that migration lands.

Verified builds: ./gradlew assembleDebug (android-kotlin), npx tsc
--noEmit (react-native), cargo test (rust-tui).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants