diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-29 20:51:13 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-06-29 20:51:13 -0700 |
commit | 49724e51630410e9a2c99a27ec7963a315f6575e (patch) | |
tree | c2802a9d0b71c2d1502e4004497b77f66970e7cf /src/main/java/org/traccar/database | |
parent | 419cc923e428dcd68ca92906bf6511cbd574b8c2 (diff) | |
download | trackermap-server-49724e51630410e9a2c99a27ec7963a315f6575e.tar.gz trackermap-server-49724e51630410e9a2c99a27ec7963a315f6575e.tar.bz2 trackermap-server-49724e51630410e9a2c99a27ec7963a315f6575e.zip |
WebSocket connection keepalive
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r-- | src/main/java/org/traccar/database/ConnectionManager.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/org/traccar/database/ConnectionManager.java b/src/main/java/org/traccar/database/ConnectionManager.java index 5ff27c187..e12d44612 100644 --- a/src/main/java/org/traccar/database/ConnectionManager.java +++ b/src/main/java/org/traccar/database/ConnectionManager.java @@ -154,6 +154,14 @@ public class ConnectionManager { return result; } + public synchronized void sendKeepalive() { + for (Set<UpdateListener> userListeners : listeners.values()) { + for (UpdateListener listener : userListeners) { + listener.onKeepalive(); + } + } + } + public synchronized void updateDevice(Device device) { for (long userId : Context.getPermissionsManager().getDeviceUsers(device.getId())) { if (listeners.containsKey(userId)) { @@ -185,6 +193,7 @@ public class ConnectionManager { } public interface UpdateListener { + void onKeepalive(); void onUpdateDevice(Device device); void onUpdatePosition(Position position); void onUpdateEvent(Event event); |