Hello everyone, I hope this topic find you all well.
I'm currently working in a project to centralize our information about the external salles team and to do so, we need to use the realtime position solution in order to manage, positions, area coverage, etc.
I have already implemented solutions that integrate our codebase with the Traccar using the standart REST API, such as team management, area managemente, and many more.
The Problem realy is when I try to connect to the websocket API, so here it goes my code and error.
async createConnection():Promise<void>{
const session = await axios.post('https://[our_server]/api/session?email=[email]&password=[password]')
const ws = new WebSocket('wss://[our_server]/api/socket', {
headers: {
cookie:[
session.headers['set-cookie'][0].replace('; Path=/', ''),
]
,
}
});
ws.on('open', () => {
console.log('Abriu');
})
console.log(ws);
}
When I run this method, the console goes blank for some time an then, return me this:
abortHandshake(
^
Error: Unexpected server response: 101
Hello everyone, I hope this topic find you all well.
I'm currently working in a project to centralize our information about the external salles team and to do so, we need to use the realtime position solution in order to manage, positions, area coverage, etc.
I have already implemented solutions that integrate our codebase with the Traccar using the standart REST API, such as team management, area managemente, and many more.
The Problem realy is when I try to connect to the websocket API, so here it goes my code and error.
async createConnection():Promise<void>{ const session = await axios.post('https://[our_server]/api/session?email=[email]&password=[password]') const ws = new WebSocket('wss://[our_server]/api/socket', { headers: { cookie:[ session.headers['set-cookie'][0].replace('; Path=/', ''), ] , } }); ws.on('open', () => { console.log('Abriu'); }) console.log(ws); }
When I run this method, the console goes blank for some time an then, return me this: