我使用的是spring-boot-starter-webflux
和spring-boot-starter-rsocket
版本2.7.1
rSocket传输设置为websocket
,如下所示:
spring.rsocket.server.transport=websocket
spring.rsocket.server.mapping-path=/rsocket
# this setting has no effect when transport==WEBSOCKET
spring.rsocket.server.port=7000
对于简单的string
,有一个spring @Controller
端点@MessageMapping
设置,如:
@MessageMapping("test")
String test() {
Logs.Info("***Received test***");
return "tested";
}
我想用Postman成功完成测试。在本地运行spring Boot 应用程序并使用mime类型连接到ws://localhost:7000
dataMimeType: 'application/json'
metadataMimeType: 'message/x.rsocket.routing.v0'
就像这样:
rsocket WebSocket连接,但我无法命中端点test
带有错误1005 No Status Received: Missing status code even though one was expected
在服务器上,错误为
DEBUG [reactor-http-nio-2] debug: [c4e97d34-1, L:/127.0.0.1:7000 - R:/127.0.0.1:2051] Cancelling Websocket inbound. Closing Websocket
DEBUG [reactor-http-nio-2] debug: [c4e97d34, L:/127.0.0.1:7000 - R:/127.0.0.1:2051] Removed handler: PongHandler, pipeline: DefaultChannelPipeline{(wsencoder = io.netty.handler.codec.http.websocketx.WebSocket13FrameEncoder), (wsdecoder = io.netty.handler.codec.http.websocketx.WebSocket13FrameDecoder), (reactor.right.reactiveBridge = reactor.netty.channel.ChannelOperationsHandler)}
DEBUG [reactor-http-nio-2] debug: [c4e97d34, L:/127.0.0.1:7000 ! R:/127.0.0.1:2051] An outbound error could not be processed
java.nio.channels.ClosedChannelException
at reactor.core.publisher.MonoErrorSupplied.call(MonoErrorSupplied.java:61)
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:228)
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onComplete(MonoIgnoreThen.java:203)
at reactor.core.publisher.SinkEmptyMulticast$VoidInner.complete(SinkEmptyMulticast.java:238)
at reactor.core.publisher.SinkEmptyMulticast.tryEmitEmpty(SinkEmptyMulticast.java:70)
at reactor.core.publisher.SinkEmptySerialized.tryEmitEmpty(SinkEmptySerialized.java:46)
Postman中的错误设置是什么?
2条答案
按热度按时间7fyelxc51#
Rsocket是一个二进制协议,虽然是基于WebSocket的,但是有很多工具可以测试它。
spring message
编写单元测试nwlls2ji2#
实际上收到了以下
message
:每个屏幕截图
但现在服务器端的错误是: