aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/AsyncSocket.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/api/AsyncSocket.java')
-rw-r--r--src/org/traccar/api/AsyncSocket.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/org/traccar/api/AsyncSocket.java b/src/org/traccar/api/AsyncSocket.java
index 7de182d7e..c289367ea 100644
--- a/src/org/traccar/api/AsyncSocket.java
+++ b/src/org/traccar/api/AsyncSocket.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
+ * Copyright 2015 - 2016 Anton Tananaev (anton.tananaev@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public class AsyncSocket extends WebSocketAdapter implements ConnectionManager.U
private Collection<Long> devices;
public AsyncSocket(long userId) {
- devices = Context.getPermissionsManager().allowedDevices(userId);
+ devices = Context.getPermissionsManager().getDevicePermissions(userId);
}
@Override
@@ -66,7 +66,7 @@ public class AsyncSocket extends WebSocketAdapter implements ConnectionManager.U
}
private void sendData(String key, Collection<?> data) {
- if (!data.isEmpty()) {
+ if (!data.isEmpty() && isConnected()) {
JsonObjectBuilder json = Json.createObjectBuilder();
json.add(key, JsonConverter.arrayToJson(data));
getRemote().sendString(json.build().toString(), null);