Commit ffceadd6 by pye52

增加心跳回调

parent 83799c01
......@@ -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();
}
}
};
......
......@@ -11,6 +11,8 @@ public interface SCWebSocketListener {
void onClose(int code, String reason, boolean remote);
void onHeartbeat();
void onError(Exception ex);
void onReconnect();
......
......@@ -22,6 +22,11 @@ public class SCWebSocketListenerAdapter implements SCWebSocketListener {
}
@Override
public void onHeartbeat() {
}
@Override
public void onError(Exception ex) {
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment