Weave Swarm
Connections
Swarm::new(SwarmConfig).await initializes the standalone swarm.
Workflow and current contract
Swarm::new(SwarmConfig).await initializes the standalone swarm. connections() returns an Arc<DashMap<PeerId, Connection>>; connection_count() reports its size. connect takes a PeerInfo, not an arbitrary bare multiaddress string.
Use send_to_peer for a specific connection, broadcast for the current set, and disconnect/shutdown for lifecycle control. Handle each asynchronous error. The transport peer ID is based on a public key and is separate from an application DID or capability grant.
Source reference
swarmdeclarations —network/weave-swarm/src/swarm.rs.connectiondeclarations —network/weave-swarm/src/connection.rs.