Hello, thank you. fyi, starting @types/ws 8.5.5, isAlive property is not recognized.
@andresmartinez-losa57797 ай бұрын
Grear tutorial! How would you authenticate with digest? Thx
@dashaxedit Жыл бұрын
Very cool. Thank you very much
@laveshsaluja947811 ай бұрын
while send headers to ws the req.headers.authorization is undefined even after sending the authToken?
@covalence-io11 ай бұрын
you can't use req.headers for websocket auth... that's kind of the whole point of the video. if you watch we put the token in the websocket url itself if using an access token ;)
@asldkfjalsdkjflaskjdfl Жыл бұрын
Hi, cool video, but I got a couple of questions: what should I do if token refreshes during the socket connection how token should be updated for opened connection properly? should I close the connection and open it again? should I develop protocol, that sends an event with new token to the server? and also I'm quite interested in how synchronizatino process should be done, if I got connection loss for some period of time I'd appreciate if someone answer at least on a couple of questions
@covalence-io Жыл бұрын
typically the authorization is done when the connection is opened... and then once it's opened you don't need to worry about it refreshing... the connection will simply remain opened until it's not. If it's closed you can handle authorization again but attempting to reopen the connection and if auth fails you may need to refresh the token. Performing synchronization well can be tough and usually involves reopening the connection while also making an api call to request past data as well and then manually adding missed data if applicable
@asldkfjalsdkjflaskjdfl Жыл бұрын
@covalence-io thank you a lot, I tried what you suggested and it works much better, then it was in my initial implementation with sending authorization token on every token refresh
@ashokchandra4911 Жыл бұрын
How to authenticate with traccar web socket api and get real time data please help
@covalence-io Жыл бұрын
Never used traccar but happy to look into it! Their documentation is a good starting point though ;) www.traccar.org/documentation/
@Samsul2013 Жыл бұрын
can you do the same websocket auth using vanilla javascript instead of typescript?
@covalence-io Жыл бұрын
The code is very similar... almost identical. You can change import statements to require statements and remove all types and you should be good to go!