Monday, 26 June 2023
  3 Replies
  1.4K Visits
  Subscribe
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?
1 year ago
·
#1625
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
·
#1627
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
·
#1629
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
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below.
Supported: gif,jpg,png,jpeg,zip,rar,pdf,pas,dfm,dpr,dproj,dpk
· Insert · Remove
  Upload Files (Maximum 10MB)