Can some please help me in understanding as why websockets or socket.io is used to make chat application if same can be achieved by TCP sockets ?
Can some please help me in understanding as why websockets or socket.io is used to make chat application if same can be achieved by TCP sockets ?
I have made a chat app with socket.io .
Scenario- Now need to store messages into localStorage of browser , when disconnect event is emited and fetch / sync that storage once user reconnects.
Issue - But problem is that if I am emiting some event from inside of "disconnect" handler back to client and there on client side inside handler for this event localStorage.setItem('msgText', msg). Its not saving to local storage.
Any suggestion is most appreciated on this ?
I have made a chat app with socket.io .
Scenario- Now need to store messages into localStorage of browser , when disconnect event is emited and fetch / sync that storage once user reconnects.
Issue - But problem is that if I am emiting some event from inside of "disconnect" handler back to client and there on client side inside handler for this event localStorage.setItem('msgText', msg). Its not saving to local storage.
Any suggestion is most appreciated on this ?
No any search results
You already invited:
1 Answers
Dmitry
Upvotes from:
also, QUIC has been gaining traction the past years especially regarding traffic between chrome and google infrastructure, this gives you a UDP based, no head-of-line blocking multiplexed streams, with zero round-trip-time encrypted communications, with actual encrypted payload data sent already in the first packet. But, only chrome/ium/opera and the caddy server support this so far
also, if you're making a peer to peer chat, you might want to use SCTP as your level 4 protocol, it combines most of the good properties of both TCP and UDP and is supported in most operating systems and also in browsers using WebRTC
SCTP is also used in SIGTRAN, to carry the vulnerable Signaling System No. 7 (which is used to set up and tear down most of the world's public switched telephone network (PSTN) telephone calls) over the IP layer. The vulnerable SS7 allow cell phone users to be secretly tracked, eavesdropping, to bypass two-factor authetication (2FA) to do unauthorized withdrawals from users bank accounts, etc.
a similar threat vector applies to the DNS system, as it's UDP based and uses the first response which looks correct, so any device on the network/wifi/isp can spoof responses, telling you that the ip of your banks domain is their ip, and give DNSSEC records telling you to expect their public key when connecting, enabling simple man-in-the-middle attacks, this can be circumvented by using DNSCrypto and DNS servers supporting DNSSEC themselves, such that you know that you're communicating with the DNS server you expect, and that the DNS response records have not been tampered with while in transport. Essentially just install something like https://simplednscrypt.org/ choose one or two DNS servers to trust and tell others to do the same