aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api/AsyncSocket.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-14 17:06:44 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-14 17:06:44 -0700
commit415ba3ddb0f770b829c997beb3e575ffb6e195ec (patch)
tree82864fbaf0126b310d3d93abe40160bb371e52c6 /src/main/java/org/traccar/api/AsyncSocket.java
parente43169b2677ea9f07154247ce7ff726d046e59e2 (diff)
downloadtrackermap-server-415ba3ddb0f770b829c997beb3e575ffb6e195ec.tar.gz
trackermap-server-415ba3ddb0f770b829c997beb3e575ffb6e195ec.tar.bz2
trackermap-server-415ba3ddb0f770b829c997beb3e575ffb6e195ec.zip
Inject connection manager
Diffstat (limited to 'src/main/java/org/traccar/api/AsyncSocket.java')
-rw-r--r--src/main/java/org/traccar/api/AsyncSocket.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/org/traccar/api/AsyncSocket.java b/src/main/java/org/traccar/api/AsyncSocket.java
index 2b866176b..3239d36c4 100644
--- a/src/main/java/org/traccar/api/AsyncSocket.java
+++ b/src/main/java/org/traccar/api/AsyncSocket.java
@@ -41,10 +41,12 @@ public class AsyncSocket extends WebSocketAdapter implements ConnectionManager.U
private static final String KEY_EVENTS = "events";
private final ObjectMapper objectMapper;
+ private final ConnectionManager connectionManager;
private final long userId;
- public AsyncSocket(ObjectMapper objectMapper, long userId) {
+ public AsyncSocket(ObjectMapper objectMapper, ConnectionManager connectionManager, long userId) {
this.objectMapper = objectMapper;
+ this.connectionManager = connectionManager;
this.userId = userId;
}
@@ -56,14 +58,14 @@ public class AsyncSocket extends WebSocketAdapter implements ConnectionManager.U
data.put(KEY_POSITIONS, Context.getDeviceManager().getInitialState(userId));
sendData(data);
- Context.getConnectionManager().addListener(userId, this);
+ connectionManager.addListener(userId, this);
}
@Override
public void onWebSocketClose(int statusCode, String reason) {
super.onWebSocketClose(statusCode, reason);
- Context.getConnectionManager().removeListener(userId, this);
+ connectionManager.removeListener(userId, this);
}
@Override