class HobbitsTransport : CoroutineScope
(source)
Hobbits is a peer-to-peer transport stack specified at https://www.github.com/deltap2p/hobbits.
This class works as a transport mechanism that can leverage a variety of network transport protocols, such as TCP, HTTP, UDP and Web sockets.
It can be used to contact other Hobbits endpoints, or to expose endpoints to the network.
incompleteMessageHandler
- a handler to manage incomplete or invalid messages
coroutineContext
- the co-routine context for the transport
HobbitsTransport(vertx: Vertx, incompleteMessageHandler: (Bytes) -> Unit = {}, coroutineContext: CoroutineContext = Dispatchers.Default)
Hobbits is a peer-to-peer transport stack specified at https://www.github.com/deltap2p/hobbits. |
val coroutineContext: CoroutineContext
the co-routine context for the transport |
fun createHTTPEndpoint(id: String = "default", networkInterface: String = "0.0.0.0", port: Int = 9337, requestURI: String? = null, tls: Boolean = false, handler: (Message) -> Unit): Unit
Creates a new endpoint over http. |
|
fun createTCPEndpoint(id: String = "default", networkInterface: String = "0.0.0.0", port: Int = 9237, tls: Boolean = false, handler: (Message) -> Unit): Unit
Creates a new endpoint over tcp persistent connections. |
|
fun createUDPEndpoint(id: String = "default", networkInterface: String = "0.0.0.0", port: Int = 9137, handler: (Message) -> Unit): Unit
Creates a new endpoint over UDP connections. |
|
fun createWSEndpoint(id: String = "default", networkInterface: String = "0.0.0.0", port: Int = 9037, requestURI: String? = null, tls: Boolean = false, handler: (Message) -> Unit): Unit
Creates a new endpoint over websocket connections. |
|
fun exceptionHandler(handler: (Throwable) -> Unit): Unit
Sets an exception handler that will be called whenever an exception occurs during transport. |
|
suspend fun sendMessage(message: Message, transport: Transport, host: String, port: Int, requestURI: String = ""): Unit
Sends a message using the transport specified. |
|
suspend fun start(): Unit
Starts the hobbits transport. |
|
fun stop(): Unit
Stops the hobbits transport. |