WebSocket - Questions

Felipe Parentea month ago

I use Traccar only as a gateway, and it is very good.

Currently in the DB I have a trigger that duplicates the data from the tc_positions table, and I have software that captures this data and does all the processing I need.

I realize that this is not the best way, and I decided to study the "WebSocket API", and I have some questions:
1 - When I generate a new token, through the web app, is this token stored somewhere? Since I may want to disable a token, how do I do this?
2 - Via Websocket, what is the kitty for sending "devices" type messages?
3 - Is there any example or JSON structure of the "devices", "positions" and "alerts" messages?

Anton Tananaeva month ago
  1. Not stored. That's why it's recommended to have short lifetime tokens.
  2. Not sure what you mean.
  3. The structure is the same as the rest of the API:

https://www.traccar.org/api-reference/

Felipe Parentea month ago

Thanks for the answers.
I'll rephrase the second question.
The websocket sends the "positions" message as the tracker transmissions arrive, but what is the trigger for the WebSocket to send the "devices" message?

Anton Tananaeva month ago

When status updates. For example device goes online/offline.

Felipe Parentea month ago

I understand, in the case of the "heartbeat" messages that the trackers send, does WebSocket also send them?

Anton Tananaeva month ago

It usually sends it on every device message because it updates last message id.