Websocket logic - backend

vrisha year ago

Good morning.

I'm going through the source code and API documentation and I had a question about how the websocket pulls data.

I noted that when the device is not moving, the websocket did not send data. But when the device started moving, the socket started sending location information almost immediately.

Is there documentation on how TracCar knows that a location has changed? Any specific pointers in the source code that I can review. I see that traccar uses JettyWebSocketServlet, but any thoughts on how the location change is determined.

Thanks for an awesome product!

Anton Tananaeva year ago

how TracCar knows that a location has changed?

It knows when a device sends new location?

vrisha year ago

So when a device sends new location, is any type of event triggered before / after saving to DB?

Is BroadcastService's listener or any other method called? Where would I look for this in the code?

Anton Tananaeva year ago

Check the AsyncSocketServlet class.