@Component public class WsSessionManager extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
WsSessionManager.SessionWrapper |
| 构造器和说明 |
|---|
WsSessionManager() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
deregister(String key)
删除 session
|
org.springframework.web.socket.WebSocketSession |
get(String key)
获得 session
|
Map<String,WsSessionManager.SessionWrapper> |
getAllSessions()
获取所有会话
|
int |
getSessionSize()
获取当前客户端连接数
|
void |
register(String key,
org.springframework.web.socket.WebSocketSession session)
添加 session
|
void |
startChecker() |
void |
updateSession(String key)
更新session消息时间
|
@PostConstruct public void startChecker()
public void register(String key, org.springframework.web.socket.WebSocketSession session) throws IOException
IOExceptionpublic void deregister(String key) throws IOException
IOExceptionpublic org.springframework.web.socket.WebSocketSession get(String key)
public void updateSession(String key)
public Map<String,WsSessionManager.SessionWrapper> getAllSessions()
public int getSessionSize()
Copyright © 2022. All rights reserved.