2

I was working on spring web-flux reactive WebSocket , so I was trying to emulate a bidirectional text communication channel by which both I can send and well as receive message , I was successfully able to run a WebSocket server

public Mono<Void> handle(WebSocketSession webSocketSession) {
     webSocketSession.receive().map(msg -> msg.getPayloadAsText())
        .doOnNext(ReactiveWebSocketHandler::processMessage).then();

    Flux<WebSocketMessage> hello = Flux.just(webSocketSession.textMessage("hello"));
    return webSocketSession.send(hello);
  }

when I start the application and hit the endpoint it replies with a message , but when I try to send a message handler is not receiving , how to establish a keep-alive bi directional WebSocket connection

user3878073
  • 81
  • 1
  • 1
  • 7

0 Answers0