In what situations would AJAX long/short polling be preferred over HTML5 WebSockets?

前端 未结 4 1067
太阳男子
太阳男子 2020-11-22 01:15

I am building a small chat application for friends, but unsure about how to get information in a timely manner that is not as manual or as rudimentary as forcing a page refr

4条回答
  •  温柔的废话
    2020-11-22 02:17

    For chat applications or any other application that is in constant conversation with the server, WebSockets are the best option. However, you can only use WebSockets with a server that supports them, so that may limit your ability to use them if you cannot install the required libraries. In which case, you would need to use Long Polling to obtain similar functionality.

提交回复
热议问题