I mean why at first place polling and server events exist if websocket can not only solve the problems they are solving but also allow additional functionalities (like bidirectional nature). I guess it has to do something with security and efficiency but on searching I couldn't find any technically subjective explanation to it. The question may sound stupid but I thought to ask rather being confused.
1 Answer
It is just historical evolution. Long-polling was a solution available with a standard HTTP
protocol and has been widely used since Web 2.0 (2000s). SSE
was invented specifically for server push and was first implemented in Opera in 2006. WebSocket
protocol is a more universal solution first implemented in Chrome in 2009.