Updates return value for Websocket return.

From @rstoyanchev:
I think serverClose and proxyClose don't need to be included in, and probably should be separated from the zip because they are sort of competing with the Mono<Void> from each WebSocketHandler, and zip will cancel the other publishers after one of them completes.
This commit is contained in:
spencergibb
2021-11-01 15:39:34 -04:00
parent 1c54a5abdf
commit 48accb783f

View File

@@ -214,8 +214,10 @@ public class WebsocketRoutingFilter implements GlobalFilter, Ordered {
Mono<Void> serverSessionSend = session
.send(proxySession.receive().doOnNext(WebSocketMessage::retain));
// .log("sessionSend", Level.FINE);
return Mono.zip(proxySessionSend, serverSessionSend, serverClose, proxyClose).then();
}
// Ensure closeStatus from one propagates to the other
Mono.when(serverClose, proxyClose).subscribe();
// Complete when both sessions are done
return Mono.zip(proxySessionSend, serverSessionSend).then(); }
/**
* Copy subProtocols so they are available downstream.