Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Improve docs on concurrent sending with direct use of WebSocket API [SPR-12886] #17484
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:
... 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
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.