By Guest on Monday, 26 June 2023
Posted in General
Replies 3
Likes 0
Views 1.4K
Votes 0
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?
Hello,

The session authentication property only works for sgcWebSockets server and client, if the server is not a sgcWebsockets server, it won't work.

If you are trying to connect using the following api

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

You can use the basic authorization which is supported by the TsgcWebsocketClient. You can read more about this in the following link :

https://www.esegece.com/help/sgcWebSockets/#t=Components%2FTsgcWebSocketClient%2FAuthentication%2FClient_Authentication.htm

Kind Regards,
Sergio
·
1 year ago
·
0 Likes
·
0 Votes
·
0 Comments
·
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.
·
1 year ago
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello,

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.

Kind Regards
Sergio
·
1 year ago
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post