websocket send position of devices that there is another user.

amin2 months ago

i have a problem.i have two users of traccar on one server.in my user websocket sends positions of devices that there are in another user.

Kaloyan Kanev2 months ago

It's only websocket or you have it and in devices list? The information is not enough, share some screenshots

amin2 months ago

its only websocket.when device send data

Anton Tananaev2 months ago

Standard Traccar will only send WebSocket updates for devices that the current user has access to. So either you're not using an official version or you're doing something wrong.

amin2 months ago

i use version 5.12 i think there is something wrong here: in method public synchronized void updateDevice:
https://github.com/traccar/traccar/blob/master/src/main/java/org/traccar/session/ConnectionManager.java

Anton Tananaev2 months ago

Highly unlikely. Someone would have noticed it by now.

amin2 months ago

when i debug in this for loop: for (long userId : deviceUsers.getOrDefault(device.getId(), Collections.emptySet()))
there is something wrong. for example i have a device with id 420 that belongs to user with id 12.but when invoke deviceUsers.getOrDefault(device.getId(), Collections.emptySet() with deviceid=12 we got userid=1;

amin2 months ago

deviceUsers.getOrDefault(device.getId(), Collections.emptySet()) this method returns all other users stay log in addition to that user belong to online device.you can test it.

amin2 months ago

anton im sorry.there was problem in my source code

Anton Tananaev2 months ago

Exactly what I suspected. In the future if you ask for help on this forum, please clearly specify upfront that you're not using an official version of Traccar and have custom code instead. But I appreciate that you at least admitted it. Most people in a similar situation will just stop posting and never admit that the issue was in their customization.

amin2 months ago

thank you very much.