websocket多线程发送内容
1.websocketSession基类接口:
org.springframework.web.socket.WebSocketSession
其中包含 getPrincipal,getLocalAddress,getRemoteAddress,sendMessage,isOpen,close等方法定义
2.接口的实现类,实现了上面的接口,采用包装设计模式,只做转发没有处理逻辑,具体看下面这个类:
org.springframework.web.socket.handler.WebSocketSessionDecorator
3.带并发的包装类:
ConcurrentWebSocketSessionDecorator
主要关注两个方法 sendMessage 和 close,
```
public void close(CloseStatus status) throws IOException {
this.closeLock.lock(); //获取关闭锁
try {
if (!this.closeInProgress) { //如果已经关闭了,则不处理
if (!CloseStatus.SESSION_NOT_RELIABLE.equals(status)) {
try {
this.checkSessionLimits(); //检查超时时间和buffer状态
} catch (SessionLimitExceededException var6) {
;
}