How client and server modes work in Hyperswarm
mainHyperswarm uses two modes for joining topics:
- Server mode: The swarm announces your keypair to the DHT so others can discover you. It accepts incoming connections from clients. When a server connection is emitted, it is not associated with a specific topic; the server only knows it received an incoming connection.
- Client mode: The swarm queries the DHT to discover available servers and eagerly connects to them. When a client connection is emitted, it is associated with the topic (the
peerInfo.topicsarray will be populated).
To join as a server, set { server: true }. To join as a client, set { client: true }.