Hello dear friends, I've been trying to connect to traccar using session, but after many attempts, here I am... Does anyone have any idea how to do it?
the only way to connect to tracar websocket is through session, the component cannot connect even through session?
WebSocket API
In addition to the REST API, we provide an access to a WebSocket endpoint for live updates. Endpoint for the WebSocket connection:
/api/socket
Session cookie is the only authorization option for the WebSocket connection.
Each message in the WebSocket stream uses the same universal JSON format:
{
"devices": [...],
"positions: [...],
"events": [...]
}
Each array contains standard JSON objects:
Device
Position
Event
If a message does not contain any objects of a certain type, the key would not be included in the JSON structure. In most cases a message contain a single type of objects.
The documentation is not clear but seems you must first login to get the session using http protocol and then connect using websocket protocol and attaching the cookie authorization.