hubRSocketConnector
The RSocketConnector which the RSocket client will be based on.
The hub-server uses springboot's RSocket implementation which expects by default, the metadata mime-type to be type of "message/x.rsocket.composite-metadata.v0", 0x7F
. Also, the hub-server expects a jwt token in setupPayload for the authorization of type "message/x.rsocket.authentication.v0", 0x7C
and the client's path in data.
Example:
val hubRSocketClient = HubRSocketClient(clientName) {
hubRSocketConnector = HubRSocketConnector {
connectionConfig {
// auth setup
setupPayload {
buildPayload {
data(buildPacket { writeText(clientName) })
compositeMetadata {
add(
WellKnownMimeType.MessageRSocketAuthentication,
buildPacket { writeText(jwt) }
)
}
}
}
// mime type setup
payloadMimeType = PayloadMimeType(
data = WellKnownMimeType.ApplicationOctetStream,
metadata = WellKnownMimeType.MessageRSocketCompositeMetadata
)
}
}
}
Content copied to clipboard