Ajax-intensive page: reuse the same XMLHttpRequest object or create new one every time?

痞子三分冷 提交于 2019-11-28 11:26:35

Create a new one when you need one. The GC will deal with the old ones once they are not needed anymore.

However, for something like a cooperative editor you might want to consider using WebSockets instead of sending requests all the time. The overhead of a small HTTP request is huge while there is almost no overhead with a WebSocket connection.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!