Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jeecg-boot
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
jeecg-boot
Commits
527007f7
Commit
527007f7
authored
Aug 28, 2019
by
zhangdaihao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
websocket会自动断开,断开时,发送通知公告无法推送 #457
parent
6c3c24fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
+7
-1
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/websocket/WebSocket.java
+7
-1
No files found.
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/message/websocket/WebSocket.java
View file @
527007f7
...
@@ -13,6 +13,8 @@ import javax.websocket.server.ServerEndpoint;
...
@@ -13,6 +13,8 @@ import javax.websocket.server.ServerEndpoint;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
@Component
@Component
...
@@ -48,7 +50,11 @@ public class WebSocket {
...
@@ -48,7 +50,11 @@ public class WebSocket {
@OnMessage
@OnMessage
public
void
onMessage
(
String
message
)
{
public
void
onMessage
(
String
message
)
{
log
.
info
(
"【websocket消息】收到客户端消息:"
+
message
);
//log.info("【websocket消息】收到客户端消息:"+message);
JSONObject
obj
=
new
JSONObject
();
obj
.
put
(
"cmd"
,
"heartcheck"
);
//业务类型
obj
.
put
(
"msgTxt"
,
"心跳响应"
);
//消息内容
session
.
getAsyncRemote
().
sendText
(
obj
.
toJSONString
());
}
}
// 此为广播消息
// 此为广播消息
...
...
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