You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.join()-ing a swarm will execute the callback once the announcement to the bittorrent network went through. However, during the announcement-process peers are already added as they appear, making the network basically usable. To clarify the state I suggest the implementation of a "connection-state".
What I am thinking about looks something like this:
swarm.on('connection-state-change',state=>{switch(state){case'disconnected': break;// Not connectedcase'connecting': break;// Join called but no peer connectedcase'connected-one-peer': break;// One peer is connected but not connected to wider networkcase'connected-many-peer': break;// Connected to more than one peercase'connected-wellknown-peer': break;// Connected to a well-known-peer - aka. the internet.}})swarm.connectionState;// Current state available as propertyswarm.join();// No callback ... necessary?!
The text was updated successfully, but these errors were encountered:
.join()
-ing a swarm will execute the callback once the announcement to the bittorrent network went through. However, during the announcement-process peers are already added as they appear, making the network basically usable. To clarify the state I suggest the implementation of a "connection-state".What I am thinking about looks something like this:
The text was updated successfully, but these errors were encountered: