New Devices Not Receiving Socket Data Until Server Restart, Cache Issue?

Basith6 days ago

Hi everyone,

I’m facing an issue where new devices added via the API show up in the device list, but do not receive any socket data until I restart the Traccar server. The server logs show that data is being received, but the WSCat WebSocket or front-end doesn’t get updates for those new devices until after a restart.

It seems like the device cache or session management is not refreshing automatically when devices are added through the API.

Has anyone else experienced this? Is there a recommended way to force cache refresh or avoid needing a restart after adding devices via API?

Thanks in advance!

Anton Tananaev6 days ago

Are you sure you registered devices first before they sent the first data?

Basith6 days ago

Thanks for the quick reply!

Yes, we did register the devices first through the API before any data was sent. We created the devices and assigned permissions properly using the permissions API.

However, we noticed that even after device creation, the server was not processing incoming data from the new devices until we restarted the server.

Anton Tananaev6 days ago

What exactly did it look like in the logs?

Basith6 days ago

In the server logs, we could clearly see incoming data packets for the new device ID, each packet logged with timestamp, device ID, and location data, confirming that the server was receiving data from the device. However, when connecting via wscat to the WebSocket endpoint, no data was being pushed for that device. The device appeared in the system (device list/UI), but no real-time data updates were visible through the WebSocket stream

Anton Tananaev6 days ago

So is it web socket only issue? Or the data is not processed at all? Those are very different things.

Basith6 days ago

Data was processed and accessible from web socket endpoint only after server restart.

However before restarting I could see the data in server logs(aws ec2) but these data where not accessible from web socket endpoint.

Anton Tananaev6 days ago

I think you should check if it's web socket issue only or not.

Basith6 days ago

Okey is there any way to invalidate and reload cache manually? If so which method/function do should we use to update the cache when new devices are added via API?

Anton Tananaev6 days ago

No way to invalidate cache manually.

Basith6 days ago

Okey thanks