S
S
Sedbol2019-12-01 23:21:20
Node.js
Sedbol, 2019-12-01 23:21:20

How to prevent two identical websocket connections from being opened?

How to prevent two identical websocket connections from being opened? I establish each connection with a GET request in order to check the user's authorization on the site, if there is none, I break it !!! And how to forbid two identical connections?
GET string request goes like this:

window.socket = new WebSocket('wss://site.ru:441?user='+app.BootData.uid+'_'+app.BootData.authKey+'');

How to break the same connection if the user opened it in another tab, or in another browser? Or close the first one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IDONTSUDO, 2019-12-13
@IDONTSUDO

There is a browser, the browser has a user agent. And you can break connections by searching for UserId + UserAgent (in the request headers).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question