I'm using reactive websockets and when the client app just closes/disconnect, the server executes the flow .doOnTerminate(){... where I call: webSocketSession.close(); When I try to reconnect again to the WebSocket, it doesn't send messages to the client anymore.

I seems I should be return Mono - but the .doOnTerminate(()-?{}... doesn't allow me to return any kind of object/response.

Comment From: rstoyanchev

As you're already suspecting, all the doOnXxx methods are merely callbacks. They are not intended for performing nested, asynchronous operations. You'll need to look to other operators of Mono but this feels like a question that would be better suited to Stack Overflow. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.

Comment From: phnxfire

@rstoyanchev Thanks for replying my post. I could resolve this issue. What was really happening is that the Flux I was using was being created as .create().share()

When I replaced it by Flux.create(publisher).publish().autoConnect(). This fixed the issue.

Thanks to @simonbasle for helping me out with this one.

I do have a follow up question here: https://stackoverflow.com/questions/67807240/reactive-websocketsession-not-able-to-retrieve-closestatus-when-connection-fini

Comment From: rstoyanchev

@phnxfire please take a closer look at my comment regarding doOnXxx methods.

Comment From: phnxfire

I understand they are callbacks - I tried to use them to collect the websocket connection closed status

https://stackoverflow.com/questions/67807240/reactive-websocketsession-not-able-to-retrieve-closestatus-when-connection-fini

Comment From: rstoyanchev

It's the same problem really sincecloseStatus returns Mono and in your snippet nothing subscribes to it.

Comment From: phnxfire

That's correct, lack of attention there - thanks for replying it.