Published on February 10, 2020
I had a conversation with a friend about their architectural structure on his work, and he mentioned the word websocket. I believe I have encoutered this word many times and I used it on one of my projects but still I don't have the full grasp idea of what is it doing.
Socket - A TCP (Transmission Control Protocol) Socket is and endpint instance defined by the combination of IP address with a port, in the context of either a listening state (a server) or a particular TCP Connection (a client, like your browser).
TCP Connection - pairing of two sockets.
3 main kinds of transports commonly use in browser web apps
In most tutorials that deal with external data, you'll deal with the left-most paradigm's HTTP requests. Actually, all of these flows are initiated with an HTTP request, as shown by the blue arrows.
I don't commonly see articles or tutorials on SSE, but MDN has a good reference in case a one-way data stream sounds intriguing.
The third flow is most interesting to us - it gives us the ability to communicate with the server over a single long-lived connection.
Use Cases for websockets