xxxxxxxxxx
@Service
public class WebFluxWebSocketHandler implements WebSocketHandler {
@Override
public Mono<Void> handle(WebSocketSession webSocketSession) {
Flux<WebSocketMessage> stringFlux = webSocketSession.receive()
.map(WebSocketMessage::getPayloadAsText)
.map(String::toUpperCase)
.map(webSocketSession::textMessage);
return webSocketSession.send(stringFlux);
}
}