Before knowing the answer to this question, you must know in client-server architecture how the server used to communicate with the server. Before socket.io there where using short-polling,long-polling, and many others. But the major disadvantage of these was that the communication has to be always initiated with by the client.
For example, if you take short polling, the client periodically sends the request to the server asking if there’s anything update, for which the server responds back with the update or just empty message, without any time delay. but the major disadvantage of this that the network gets congested with these continuous requests, even when there are no updates.
If you take in case of long polling, the client sends the request to the server asking if there’s anything update with a suitable timeout, for which the server would send back a response if there is an update, but here to the major disadvantage is that the client will continuously make the request.
To overcome this we use web socket which has one TCP connection between the client and server always open, to ensure bi-directional communication between the client and server.