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

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.

Constructors

<init>

NetworkService(multiplexer: Multiplexer!)

Functions

createChangesStream

Opens a stream of peer connection state changes.

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

generateInviteCode

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!>!

getAllKnownPeers

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

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

getConnectedPeers

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

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

redeemInviteCode

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!