Commit ffceadd6 by pye52

增加心跳回调

parent 83799c01
...@@ -241,6 +241,9 @@ public class SCWebSocketClient extends WebSocketClient { ...@@ -241,6 +241,9 @@ public class SCWebSocketClient extends WebSocketClient {
Heartbeat request = new Heartbeat(deviceSN); Heartbeat request = new Heartbeat(deviceSN);
String requestStr = gson.toJson(request); String requestStr = gson.toJson(request);
send(requestStr); send(requestStr);
for (SCWebSocketListener l : listener) {
l.onHeartbeat();
}
} }
}; };
......
...@@ -11,6 +11,8 @@ public interface SCWebSocketListener { ...@@ -11,6 +11,8 @@ public interface SCWebSocketListener {
void onClose(int code, String reason, boolean remote); void onClose(int code, String reason, boolean remote);
void onHeartbeat();
void onError(Exception ex); void onError(Exception ex);
void onReconnect(); void onReconnect();
......
...@@ -22,6 +22,11 @@ public class SCWebSocketListenerAdapter implements SCWebSocketListener { ...@@ -22,6 +22,11 @@ public class SCWebSocketListenerAdapter implements SCWebSocketListener {
} }
@Override @Override
public void onHeartbeat() {
}
@Override
public void onError(Exception ex) { 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