diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-14 17:06:44 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-14 17:06:44 -0700 |
commit | 415ba3ddb0f770b829c997beb3e575ffb6e195ec (patch) | |
tree | 82864fbaf0126b310d3d93abe40160bb371e52c6 /src/main/java/org/traccar/api/AsyncSocketServlet.java | |
parent | e43169b2677ea9f07154247ce7ff726d046e59e2 (diff) | |
download | trackermap-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/AsyncSocketServlet.java')
-rw-r--r-- | src/main/java/org/traccar/api/AsyncSocketServlet.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/api/AsyncSocketServlet.java b/src/main/java/org/traccar/api/AsyncSocketServlet.java index 4e55dfebf..317ec469e 100644 --- a/src/main/java/org/traccar/api/AsyncSocketServlet.java +++ b/src/main/java/org/traccar/api/AsyncSocketServlet.java @@ -21,6 +21,7 @@ import org.eclipse.jetty.websocket.server.JettyWebSocketServletFactory; import org.traccar.Context; import org.traccar.api.resource.SessionResource; import org.traccar.config.Keys; +import org.traccar.session.ConnectionManager; import javax.inject.Inject; import javax.servlet.http.HttpSession; @@ -29,10 +30,12 @@ import java.time.Duration; public class AsyncSocketServlet extends JettyWebSocketServlet { private final ObjectMapper objectMapper; + private final ConnectionManager connectionManager; @Inject - public AsyncSocketServlet(ObjectMapper objectMapper) { + public AsyncSocketServlet(ObjectMapper objectMapper, ConnectionManager connectionManager) { this.objectMapper = objectMapper; + this.connectionManager = connectionManager; } @Override @@ -41,7 +44,7 @@ public class AsyncSocketServlet extends JettyWebSocketServlet { factory.setCreator((req, resp) -> { if (req.getSession() != null) { long userId = (Long) ((HttpSession) req.getSession()).getAttribute(SessionResource.USER_ID_KEY); - return new AsyncSocket(objectMapper, userId); + return new AsyncSocket(objectMapper, connectionManager, userId); } else { return null; } |