tuweni / org.apache.tuweni.scuttlebutt.lib / NetworkService


open class NetworkService (source)

A service for operations that connect nodes together and other network related operations

Assumes the standard 'ssb-gossip' plugin is installed and enabled on the node that we're connected to (or that RPC functions meeting its manifest's contract are available.).

Should not be constructed directly, should be used via an ScuttlebuttClient instance.



NetworkService(multiplexer: Multiplexer!)



Opens a stream of peer connection state changes.

open fun createChangesStream(streamHandler: Function<Runnable!, StreamHandler<PeerStateChange!>!>!): Unit


Generates an invite code which can be used by another node to connect to our node, and have each node will befriend each other.

open fun generateInviteCode(validForUses: Int): AsyncResult<Invite!>!


Queries for all the peers the instance is aware of in its gossip table.

open fun getAllKnownPeers(): AsyncResult<MutableList<Peer!>!>!


Queries for the list of peers the instance is connected to.

open fun getConnectedPeers(): AsyncResult<MutableList<Peer!>!>!


Redeems an invite issued by another node. If successful, the node will connect to the other node and each node will befriend each other.

open fun redeemInviteCode(invite: Invite!): AsyncCompletion!