Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hel-developer-guide
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hel-guide
hel-developer-guide
Commits
76f19c4a
Commit
76f19c4a
authored
Jan 25, 2018
by
冯景珉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update websocket.md
parent
8dcad5e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
websocket.md
框架功能描述/websocket.md
+3
-0
No files found.
框架功能描述/websocket.md
View file @
76f19c4a
...
...
@@ -49,11 +49,14 @@ function initWebSocket() {
#### 获取SocketSessionMap
1.
先注入WebSocketSessionManager类型bean。
2.
调用其中的getSession方法,其中包含两个getSession方法:
*
getSession(String username) 可以根据username获取对应的webscoketSession集合。
*
getSession(String userId)可以根据userId获取对应的websocketSession集合。
3.
获取websocketSession对象之后,调用其中的sendMessage方法即可,参数推荐自己构造一个TextMessage类型的对象,其中构造方法参数为String类型。
4.
建议在发送消息前进行连接进行状态判断,避免异常,以及及时从集合中移除无用的websocketSession。
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment