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

Improve docs on concurrent sending with direct use of WebSocket API [SPR-12886] #17484

Closed
spring-issuemaster opened this issue Apr 3, 2015 · 2 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Apr 3, 2015

knockout user opened SPR-12886 and commented

Inside the websocket package there is the ConcurrentWebSocketSessionDecorator class. I'm thinking of using this because I have multiple components writing to the same websocket and want to remove the external locking I now have in place.

But I can't find any example of the way to use this class. I'm thinking something like this should do it:

public class MyWebsocketHandler extends TextWebSocketHandler {
@Override
protected void handleTextMessage(WebSocketSession websocketSession, TextMessage message) throws Exception {
    ConcurrentWebSocketSessionDecorator concurrentWebsocketSession = new ConcurrentWebSocketSessionDecorator(websocketSession, sendTimeLimit, bufferSizeLimit);
....

... then have the concurrentWebsocketSession sent downstream to all components who need it.

Is this all there is to it? Could the documentation be updated to at least mention this (very useful) class?


Referenced from: commits 14e87d2

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 3, 2015

Rossen Stoyanchev commented

We use on the server side in SubProtocolWebSocketHandler. See the afterConnectionEstablished method which decorates each new session and stores the result in a map. Subsequently we always use decorated sessions. Also note the sendTimeLimit and sendBufferSizeLimit on SubProtocolWebSocketHandler which are used to configure timeout and buffering per session.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Dec 12, 2018

Rossen Stoyanchev commented

I've updated the docs. It's basically about wrapping the session, and using it through that wrapper. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.