aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/AsyncSocket.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-04-16 11:47:03 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-04-16 11:47:03 +1200
commitef25655365eb97d29295f8e0cb720b86a29c5e26 (patch)
tree49662363442f0af20b05b324fa4b663995d51fc7 /src/org/traccar/api/AsyncSocket.java
parentc463798c9e1d72c0c51cd4321826df1ff8609a5d (diff)
downloadtrackermap-server-ef25655365eb97d29295f8e0cb720b86a29c5e26.tar.gz
trackermap-server-ef25655365eb97d29295f8e0cb720b86a29c5e26.tar.bz2
trackermap-server-ef25655365eb97d29295f8e0cb720b86a29c5e26.zip
Bind async connection to user id
Diffstat (limited to 'src/org/traccar/api/AsyncSocket.java')
-rw-r--r--src/org/traccar/api/AsyncSocket.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/org/traccar/api/AsyncSocket.java b/src/org/traccar/api/AsyncSocket.java
index 5353a8d85..35e760613 100644
--- a/src/org/traccar/api/AsyncSocket.java
+++ b/src/org/traccar/api/AsyncSocket.java
@@ -33,26 +33,26 @@ public class AsyncSocket extends WebSocketAdapter implements ConnectionManager.U
private static final String KEY_DEVICES = "devices";
private static final String KEY_POSITIONS = "positions";
- private Collection<Long> devices;
+ private long userId;
public AsyncSocket(long userId) {
- devices = Context.getPermissionsManager().getDevicePermissions(userId);
+ this.userId = userId;
}
@Override
public void onWebSocketConnect(Session session) {
super.onWebSocketConnect(session);
- sendData(KEY_POSITIONS, Context.getConnectionManager().getInitialState(devices));
+ sendData(KEY_POSITIONS, Context.getConnectionManager().getInitialState(userId));
- Context.getConnectionManager().addListener(devices, this);
+ Context.getConnectionManager().addListener(userId, this);
}
@Override
public void onWebSocketClose(int statusCode, String reason) {
super.onWebSocketClose(statusCode, reason);
- Context.getConnectionManager().removeListener(devices, this);
+ Context.getConnectionManager().removeListener(userId, this);
}
@Override