public class WebSocketSessionManager extends Object
| 构造器和说明 |
|---|
WebSocketSessionManager() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
add(String userName,
org.springframework.web.socket.WebSocketSession session)
添加 session
|
static void |
addOnlineCount()
在线用户加1
|
static org.springframework.web.socket.WebSocketSession |
get(String userName)
获得 session
|
static List<org.springframework.web.socket.WebSocketSession> |
getAll()
查询所有在线用户session
|
static List<String> |
getAllUserName()
查询所有在线用户名称
|
static int |
getOnlineCount()
统计在线用户数量
|
static org.springframework.web.socket.WebSocketSession |
remove(String userName)
删除 session,会返回删除的 session
|
static void |
removeAndClose(String userName)
删除并同步关闭连接
|
static void |
subOnlineCount()
在线用户减1
|
public static void add(String userName, org.springframework.web.socket.WebSocketSession session)
userName - 用户名称public static org.springframework.web.socket.WebSocketSession remove(String userName)
userName - 用户名public static void removeAndClose(String userName)
userName - 指定用户public static org.springframework.web.socket.WebSocketSession get(String userName)
userName - 用户名称public static List<org.springframework.web.socket.WebSocketSession> getAll()
public static int getOnlineCount()
public static void addOnlineCount()
public static void subOnlineCount()
Copyright © 2022. All rights reserved.