blockingHubRSocketClient
fun blockingHubRSocketClient(hubInstance: HubServerRSocketInstance, connector: HubServerConnector, context: CoroutineContext = getHubClientCoroutineContext()): HubRSocketClient
A blocking builder function for creating a HubRSocketClient.
Note: This factory is using bridging code, to provide a usable API for non-suspending code. It is not to be used from a coroutine. For a suspended builder see HubRSocketClient.
Usage example
// sets up auth through `SetupPayload`
val setupPayload = SetupPayload.withJwt(clientName, jwt)
val hubServerConnector = HubServerConnector(setupPayload = setupPayload)
// the context which the client will run on, can be omitted if default is used
val hubServerContext = getHubClientCoroutineContext()
// the server-client which this client represents
val client = ServerClient(ServerKey("SomeClientId"), ServerClientConfig(AcceptableMessageType.SIGNAL_AND_NON_SIGNAL))
// the instance of hub-server to be connected on
val hubServerRSocketInstance = HubServerRSocketInstance(client, "0.0.0.0", serverPort)
// the blocking builder
val hubClient = blockingHubRSocketClient(
hubServerRSocketInstance,
hubServerConnector,
hubServerContext
)
Content copied to clipboard
Parameters
hubInstance
a wrapper around ServerClient and the instance of hub-server.
connector
the hubRSocketConnector which the RSocket
client will be based on.
context
the CoroutineContext which the client will run in. In most use cases the default value will suffice. In case there is a need for an addition on top of the default value and not complete overwrite, the default value can be retrieved through getHubClientCoroutineContext.