How to set SETUP setupRoute
sdack-cloud opened this issue · 0 comments
sdack-cloud commented
spring version: 2.7.2
rsocket: 1.1.2
spring Server
@ConnectMapping("conn")
fun connect(requester: RSocketRequester, @Payload client: String?) {}
spring client. RESULT : OK
val tokenMetadata = BearerTokenMetadata(token)
val uri = URI.create("ws://localhost:7002")
rSocketRequester = RSocketRequester.builder()
.setupMetadata(tokenMetadata, SIMPLE_AUTH)
.setupRoute("conn")
.setupData("4,333")
.rsocketStrategies {
it.encoder(ProtobufEncoder())
.decoder( ProtobufDecoder())
}
.websocket(uri)
rsocket client RESULT: Error
val metadata = ByteBufAllocator.DEFAULT.compositeBuffer()
val routingMetadata = TaggingMetadataCodec.createRoutingMetadata(ByteBufAllocator.DEFAULT, listOf("conn"))
CompositeMetadataCodec.encodeAndAddMetadata(
metadata, ByteBufAllocator.DEFAULT,
WellKnownMimeType.MESSAGE_RSOCKET_ROUTING,
routingMetadata.content
)
val bearerMetadata = AuthMetadataCodec.encodeMetadata(ByteBufAllocator.DEFAULT, WellKnownAuthType.BEARER, Unpooled.copiedBuffer(token, CharsetUtil.UTF_8))
CompositeMetadataCodec.encodeAndAddMetadata(
metadata, ByteBufAllocator.DEFAULT,
WellKnownMimeType.MESSAGE_RSOCKET_AUTHENTICATION,
bearerMetadata
)
rSocket = RSocketConnector.create()
.metadataMimeType(WellKnownMimeType.MESSAGE_RSOCKET_AUTHENTICATION.string)
.dataMimeType(WellKnownMimeType.APPLICATION_CBOR.string)
.setupPayload(DefaultPayload.create("4,333".toByteArray(),ByteBufUtil.getBytes(metadata)))
.connect(transport)
rsocket client. Cannot map to @ConnectMapping("conn")