Use WebsocketOutbound#sendClose

Switch to using the sendClose method available since Reactor Netty 0.8
vs explicitly sending a CloseWebSocketFrame.

Related to SPR-17306, but does not address the root cause.
master
Rossen Stoyanchev 6 years ago
parent e63bffcfa0
commit 1320fed7fe
  1. 4
      spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/ReactorNettyWebSocketSession.java

@ -15,7 +15,6 @@
*/ */
package org.springframework.web.reactive.socket.adapter; package org.springframework.web.reactive.socket.adapter;
import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame;
import io.netty.handler.codec.http.websocketx.WebSocketFrame; import io.netty.handler.codec.http.websocketx.WebSocketFrame;
import org.reactivestreams.Publisher; import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux; import reactor.core.publisher.Flux;
@ -98,8 +97,7 @@ public class ReactorNettyWebSocketSession
@Override @Override
public Mono<Void> close(CloseStatus status) { public Mono<Void> close(CloseStatus status) {
WebSocketFrame closeFrame = new CloseWebSocketFrame(status.getCode(), status.getReason()); return getDelegate().getOutbound().sendClose(status.getCode(), status.getReason());
return getDelegate().getOutbound().sendObject(closeFrame).then();
} }

Loading…
Cancel
Save