Websocket and Sessions

Anton Tananaev 3 years ago

Have you checked our official documentation?

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

Brad 3 years ago

Will check it and try the websocket API.

Thanks again !

Brad 3 years ago

Hi again,

Thanks, I have tried the websocket api and it is connecting and running fine.
Please let me know if I have to add this in another separate topic.

Just wanted to ask about something regarding the websocket API.
Through websocket connection I am able to access the data coming from devices, this data is coming from devices that perform requests to the server (HTTP requests using osmand). But, how can I avoid making many updates/http requests to the server by each device and instead gather all devices' data in a socket and make one single http request by that websocket that contains all devices data to the server?
Ty.

Anton Tananaev 3 years ago

Not sure I understand the question. You can't use WebSocket to push data to the server, if that's what you're asking.

Navneet Choudhary 2 years ago

Hey Brad,

Can you share some code sample how the websockets are working for you.
I have read full conversation and i am having exect same issue i have generated sessions using end point just like you but websocket endpoint is not working for me in postman:

Error: getaddrinfo ENOTFOUND https
andshake Details
Request URL: http://https//demo4.traccar.org/api/socket
Request Method: GET
Request Headers
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: unswNSzz+wQLEMnT1QYU4g==
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

can anyone tell me what i am doing wrong?