What is the disadvantage of using websocket/socket.io where ajax will do?

后端 未结 8 1610
余生分开走
余生分开走 2020-12-07 11:30

Similar questions have been asked before and they all reached the conclusion that AJAX will not become obsolete. But in what ways is ajax better than websockets?

Wit

8条回答
  •  星月不相逢
    2020-12-07 11:42

    If you want the connection to server open and if continuous polling to the server will be there then go for sockets else you are good to go with ajax.

    Simple Analogy : Ajax asks questions(requests) to server and server gives answers(responses) to these questions. Now if you want to ask continuous questions then ajax wont work, it has a large overhead which will require resources at both the ends.

提交回复
热议问题