Devices' location updates only every 60 seconds

Tibor3 years ago

Dear Anton,
I'm facing a problem with the web UI. I have 10 devices whose locations are updated every 5 seconds(via OsmAnd protocol), but on the web UI, the positions are updated only about every 60 seconds, and at that time all of them are moved to the newest position. The log shows that it is receiving the data and the report also shows the "missing" points, which are not shown in between the location updates.
Searching the forum, I can see that there is no configuration for the update interval and that the location should be updated as soon as the new data is received, but it does not work that way in my case. I have the following filters enabled:

<entry key='filter.zero'>true</entry>
<entry key='distance.enable'>true</entry>
<entry key='coordinates.filter'>true</entry>
<entry key='coordinates.maxError'>200</entry>

My install is official on a Raspberry Pi 3.
Is there something that I can do to make it update in real time?

Anton Tananaev3 years ago

Sounds like you have some issues with websocket connection. Check your browser developer console.

Tibor3 years ago

That's right, I get the following error:

WebSocket connection to 'ws://rimmap.local/gps/api/socket' failed: 
asyncUpdate @ app.min.js:467
(anonymous) @ app.min.js:468

I'm not into JS programming, can you give me some guideline, how to fix the issue? I still get updates, but not in real-time. Is it a problem, that I send several request? The maximum is 7 requests/second.

Anton Tananaev3 years ago

You have to check why it failed. Check actual network request, not just error in the console.

Tibor3 years ago

I found the culprit. I was using ProxyPass in apache2 based on a forum entry here. The configuration looks like this:

ProxyPass /gps/api/socket ws://localhost:8082/api/socket
ProxyPassReverse /gps/api/socket ws://localhost:8082/api/socket

ProxyPass /gps/ http://localhost:8082/
ProxyPassReverse /gps/ http://localhost:8082/
ProxyPassReverseCookiePath / /gps/

Redirect permanent /gps /gps/

I am also using the cdn repository locally, because my application is completely offline. To solve this, I edited the load.js and replaced the cdn online links with the following:

addScriptFile('/gps/traccar-cdn/js/extjs/' + extjsVersion + '/ext-all-debug.js');

...(modified every line that includes the path)

Then, when I accessed the application via the address: http://hostname.local/gps, the websocket error popped up, because it did not reach the correct script. So I switched back to accessing the application via http://hostname.local:8082, which then failed to load the scripts again, but I could solve it by modifying load.js again and I removed /gps/ from the location, so it looks like this now:

addScriptFile('/traccar-cdn/js/extjs/' + extjsVersion + '/ext-all-debug.js');

...(modified every line that includes the path)

So it works fine now. If you can tell me what I need to do, in order to make it work with http://hostname.local/gps that would be appreciated, although it's good enough already.

Cheers Anton!