class ClientService : IClientService
Connection to the P2P network.
companion object Companion : KLogging
Logging companion |
ClientService(bootstrapPeerAddress: PeerAddress, peerPort: Int? = findFreePort())
Creates a peer and bootstraps with a given TomP2P Peer Address. Optionally, set the port this peer uses. ClientService(bootstrapPeers: List<PeerConnectionDetails>, peerPort: Int?)
Creates a peer and bootstraps with a given IP/port pair. Optionally, set the port this peer uses. ClientService(peerPort: Int? = findFreePort())
Creates a peer. Optionally, set the port this peer uses |
var bootstrapPeers: List<PeerConnectionDetails>
Peers used for bootstrapping |
|
val emitterMap: ConcurrentHashMap<String, (ExternalClient, ClientMessage) -> Unit>
Map of user's session ID to their message handlers. See InternalClient.onReceiveMessage |
|
internal var peer: PeerDHT
The TomP2P peer |
|
val peerId: String
The peer's ID |
fun addClient(sessionId: String): Pair<IInternalClient, Future>
Add a new user. |
|
fun addDirectMessageListener(sessionId: String, emitter: (IExternalClient, ClientMessage) -> Unit): Unit
Add a direct message listener. See InternalClient.onReceiveMessage |
|
fun bootstrapPeer(peerAddress: PeerAddress): Unit
Bootstrap our peer to another peer. Only used for testing! |
|
fun bootstrapPeers(peersDetails: List<PeerConnectionDetails>): Unit
Bootstrap our peer to another peer |
|
fun findClient(sessionId: String): GetFuture<IExternalClient>
Find another user |
|
fun removeClient(client: IInternalClient): Future
Remove a user. |
|
fun setupDirectMessageListener(): Unit
Setup the dispatcher to send the incoming messages to the correct user |