Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ffceadd6
authored
May 11, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加心跳回调
parent
83799c01
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
app/src/main/java/com/bgycc/smartcanteen/socket/SCWebSocketClient.java
+3
-0
app/src/main/java/com/bgycc/smartcanteen/socket/SCWebSocketListener.java
+2
-0
app/src/main/java/com/bgycc/smartcanteen/socket/SCWebSocketListenerAdapter.java
+5
-0
No files found.
app/src/main/java/com/bgycc/smartcanteen/socket/SCWebSocketClient.java
View file @
ffceadd6
...
...
@@ -241,6 +241,9 @@ public class SCWebSocketClient extends WebSocketClient {
Heartbeat
request
=
new
Heartbeat
(
deviceSN
);
String
requestStr
=
gson
.
toJson
(
request
);
send
(
requestStr
);
for
(
SCWebSocketListener
l
:
listener
)
{
l
.
onHeartbeat
();
}
}
};
...
...
app/src/main/java/com/bgycc/smartcanteen/socket/SCWebSocketListener.java
View file @
ffceadd6
...
...
@@ -11,6 +11,8 @@ public interface SCWebSocketListener {
void
onClose
(
int
code
,
String
reason
,
boolean
remote
);
void
onHeartbeat
();
void
onError
(
Exception
ex
);
void
onReconnect
();
...
...
app/src/main/java/com/bgycc/smartcanteen/socket/SCWebSocketListenerAdapter.java
View file @
ffceadd6
...
...
@@ -22,6 +22,11 @@ public class SCWebSocketListenerAdapter implements SCWebSocketListener {
}
@Override
public
void
onHeartbeat
()
{
}
@Override
public
void
onError
(
Exception
ex
)
{
}
...
...
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