Hi guys, first post from me so hello and Traccar is awesome :)
I would like to connect to the Traccar Web socket api (mywebapp:8082/api/socket) from a MeteorJS server
import { Socket } from 'socket.io-client';
HTTP.post('http://localhost:8082/api/session', {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
content: "email=SOME_EMAIL&password=SOME_PASSWORD"
}, function(response, some){
console.log(response);
var socket = new Socket('ws://localhost:8082/api/socket');
console.log(socket);
}
The HTTP post response is ok and I can retrieve the JSESSIONID but I can not attach a cookie to the new Socket()
request.
Is there a way to add the JSESSIONID as a query param instead of as a cookie? Or would you know a way for me to add a cookie to the Socket() connection?
Browser includes the cookie automatically. I'm not sure how to do it in Node.js, but there must be a way to supply an additional header (cookie).
Yeah I thought that as well, but it looks like it's not possible :s
So just to be sure, there is no other way than sending a cookie header along for authentication?
I'm about to poll the http api every second :(
Thanks for sharing the link.
Hi guys, first post from me so hello and Traccar is awesome :)
I would like to connect to the Traccar Web socket api (mywebapp:8082/api/socket) from a MeteorJS server
The HTTP post response is ok and I can retrieve the JSESSIONID but I can not attach a cookie to the
new Socket()
request.Is there a way to add the JSESSIONID as a query param instead of as a cookie? Or would you know a way for me to add a cookie to the Socket() connection?