Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocketSession should expose method to indicate whether it is still active [SPR-16126] #20674

Closed
spring-projects-issues opened this issue Oct 27, 2017 · 3 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Oct 27, 2017

Mikhail Konovalov opened SPR-16126 and commented

Hi

in non-reactive API WebSocketSession has method isOpen.
In reactive - not!

How can I determine whether client closed the connection to stop my Flux?


Affects: 5.0 GA

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jan 12, 2018

Rossen Stoyanchev commented

We might have to add a method like that. For now you'll have to look for the onComplete/onError signals from session.receive().

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented May 17, 2018

Rossen Stoyanchev commented

On further thought, I don't think such a method makes sense. For once a return value of "true" from isOpen does not guarantee the connection won't be closed simultaneously, before you try to write a message. So you still have to deal with the potential failure.

More importantly though the idea with this type of API is that when you compose a unified flow, the completion, error, and cancellation signals should do the right thing to terminate both the inbound and outbound stream of messages.

To that end I've updated the reference and the Javadoc with example implementations and comments. Please have a look. In particular see the paragraph on connection closing at the end of the Javadoc for WebSocketHandler. Let me know if you have further questions.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented May 17, 2018

Rossen Stoyanchev commented

The reference and Javadoc have been updated some more. Same links, just refresh.

@spring-projects-issues spring-projects-issues added status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants