Traccar already has websockets. See official web app for more details.
I am looking for websockets in the traccar server. Dont see any.
Who the webapp is connecting to via websocket ? Sorely it cannot be the traccar server
Ok, I see something like AsyncSocket, I will dig more from there.
It is and it has been like that for a very long time:
https://github.com/tananaev/traccar/blob/master/src/org/traccar/web/WebServer.java#L168
But when I try connecting to a socket at ws://0.0.0.0:8082/api/socket using a couple of chrome plugins, i cannot connect and they say "no protocol negotiations"
The API is working fine at http://0.0.0.0:8082/api
api/socket is the path that is being used in Root.js as well, so I think that is correct, what can be wrong with my setup ?
You need to pass authentication cookie in the header when you open socket.
Hi Anton, iv been having similar issues and i'd like to ask if you could give me some guidelines or an example of how id be able to pass authentication cookie in the header using a Java client
See native version of Traccar Manager for a Java example.
Hello all, Anton,
The API calls are working properly, but I'm unable to utilize the websocket on my server. I tried this URI wss://<mydomain>/gps/api/socket on some firefox extensions, and the websocket opens successfully without authentication, and the only message it outputs is the positions and details of all devices. Nothing happens after that. If I disconnect and reconnect the websocket, again it outputs the same message.
How do I interact with the websocket so that it keeps live positions and events data flowing and how can I implement in vanilla JS?
Thankyou in advance.
Just wait and you should get live updates.
Right now the server is a proper RESTful server, how would I go about adding websockets for specific purposes to it (just to reduce the authentication overhead for very frequent calls)
Anybody else here tried modifying the code to use websockets ?