Spring webflux websocket closed when receive message too fast

Viewed 38
enter code herepublic Mono<Void> handle(@Nonnull WebSocketSession session) {
    final WebSocketContext webSocketContext = new WebSocketContext(session);
    Mono<Void> output = session.send(Flux.create(webSocketContext::setSink));
    Mono<Void> input = session.receive()
            .timeout(Duration.ofSeconds(adapterProperties.getSessionTimeout()))
            .doOnSubscribe(subscription -> subscription.request(64))
            .doOnNext(WebSocketMessage::retain)
            .publishOn(Schedulers.boundedElastic())
            .concatMap(msg -> {
                // ....blocking operation
                return Flux.empty();
            }).then();
    return Mono.zip(input, output).then();

When I use ws client to send information, because the message sending speed is too fast, when 2000 pieces of data are received, the connection is disconnected and there is no exception message, After I slow down the sending speed of the message on the client side, there is no problem. How can I solve it?

Below is the Flux log information: 2022-07-14 17:19:40.295 adapter-iat [boundedElastic-5] INFO reactor.Flux.PublishOn.5 - | onNext(WebSocket TEXT message (13765 bytes))

2022-07-14 17:19:40.296 adapter-iat [boundedElastic-5] INFO reactor.Flux.PublishOn.5 - | onNext(WebSocket TEXT message (13765 bytes))

2022-07-14 17:19:40.300 adapter-iat [boundedElastic-5] INFO reactor.Flux.PublishOn.5 - | onComplete()????why

0 Answers
Related