aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-12-15 14:51:57 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-12-15 14:51:57 +1300
commitf5ab3489c9abdc825dd5297829119813740e32e6 (patch)
tree62d872377f9a2125b5b5dd097c75a2acaedf41dd /src
parent44d38a8f121304fc6504ebaabbfb0a402779ca1d (diff)
downloadtrackermap-server-f5ab3489c9abdc825dd5297829119813740e32e6.tar.gz
trackermap-server-f5ab3489c9abdc825dd5297829119813740e32e6.tar.bz2
trackermap-server-f5ab3489c9abdc825dd5297829119813740e32e6.zip
Use web socket instead of long polling
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/api/AsyncSocket.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/org/traccar/api/AsyncSocket.java b/src/org/traccar/api/AsyncSocket.java
index fe20081d3..7de182d7e 100644
--- a/src/org/traccar/api/AsyncSocket.java
+++ b/src/org/traccar/api/AsyncSocket.java
@@ -66,9 +66,11 @@ public class AsyncSocket extends WebSocketAdapter implements ConnectionManager.U
}
private void sendData(String key, Collection<?> data) {
- JsonObjectBuilder json = Json.createObjectBuilder();
- json.add(key, JsonConverter.arrayToJson(data));
- getRemote().sendString(json.build().toString(), null);
+ if (!data.isEmpty()) {
+ JsonObjectBuilder json = Json.createObjectBuilder();
+ json.add(key, JsonConverter.arrayToJson(data));
+ getRemote().sendString(json.build().toString(), null);
+ }
}
}