Skip to content

v10.2.0: LAN peer discovery and sync

Compare
Choose a tag to compare
@sgwilym sgwilym released this 16 May 11:25
· 13 commits to main since this release

This is a feature release adding APIs to automatically discover and sync with peers on the local network. Automatically find and sync with friends at a café, or with your own devices at home.

// Start a new discovery service, and advertise ourselves as "My Computer".
const discoveryLan = new DiscoveryLAN({ name: "My Computer" });

// Wait for new discovery service events...
for await (const discoveryEvent of peer.discover(discoveryLan)) {
  if (discoveryEvent.kind === "PEER DISCOVERED") {
    // We'll sync with everyone we find!
    discoveryEvent.sync();
  }
}

Discovery is powered by dns_sd, and sync itself is powered by a new fully encrypted TCP transport driver.

  • (Feature) Added Peer.discover, a new method for automatically discovering other peers. How it does that it left to the DiscoveryService you provide it.
  • (Feature) Added DiscoveryLAN, a discovery service for finding and advertising yourself to other peers on the local network. Works for both Node and Deno, requires --unstable on Deno.