tuweni / org.apache.tuweni.rlpx.wire / DefaultWireConnection

DefaultWireConnection

class DefaultWireConnection : WireConnection (source)

A stateful connection between two peers under the Devp2p wire protocol.

Constructors

<init>

DefaultWireConnection(id: String, nodeId: Bytes, peerNodeId: Bytes, logger: Logger, writer: Consumer<RLPxMessage>, afterHandshakeListener: Consumer<HelloMessage>, disconnectHandler: Runnable, subprotocols: LinkedHashMap<SubProtocol, SubProtocolHandler>, p2pVersion: Int, clientId: String, advertisedPort: Int)

Default constructor.

Functions

disconnect

fun disconnect(reason: DisconnectReason): Unit

Sends a message to the peer explaining that we are about to disconnect.

handleConnectionStart

fun handleConnectionStart(): Unit

id

fun id(): String

messageReceived

fun messageReceived(message: RLPxMessage): Unit

sendMessage

fun sendMessage(subProtocolIdentifier: SubProtocolIdentifier, messageType: Int, message: Bytes): Unit

sendPing

fun sendPing(): AsyncCompletion

Sends a ping message to the remote peer.

toString

fun toString(): String