一、问题
向netty websocket服务发送消息后,服务端发送响应消息时,websocket连接自动断开
1. 环境
spring-webflux版本:5.3.9
netty版本:4.1.67.Final
2. 代码
@Slf4j
@Component
public class WebSocketMainHandler implements WebSocketHandler {
......
@Override
public Mono<Void> handle(WebSocketSession session) {
InetSocketAddress inetSocketAddress = session.getHandshakeInfo().getRemoteAddress();
String hostAddress = inetSocketAddress.getAddress().getHostAddress();
int port = inetSocketAddress.getPort();
String sessionKey = ClientSession.generateSessionKey(hostAddress, port);
Mono<Void> input = session.receive()
.doOnNext(message -> {
if (WebSocketMessage.Type.TEXT == message.getType()) {
WebSocketData webSocketData = parseMess