哪个更快 - WebSockets还是Ajax?

时间:2022-03-16 12:40:38

I bet WebSockets are much faster. So if I want to use lots of ajax continuously, WebSockets are recommended as an alternative?

我敢打赌WebSockets要快得多。因此,如果我想连续使用大量的ajax,建议使用WebSockets作为替代方案吗?

5 个解决方案

#1


3  

It's two different technology things. With AJAX client just send request to server and wait to response. Websocket is HTML5 implementation for Comet technology, the idea is push information from server to client.

这是两种不同的技术。使用AJAX客户端只需向服务器发送请求并等待响应。 Websocket是Comet技术的HTML5实现,其思路是从服务器到客户端的推送信息。

#2


1  

Ajax is slower because the overhead. But Ajax is more compatible, Websocket is currently a bit experimental and it is not widely supported by most browser.

Ajax因为开销较慢。但Ajax更兼容,Websocket目前有点实验性,并没有得到大多数浏览器的广泛支持。

#3


0  

I think is not a issue of speed, is a issue of comunication and real time process

我认为不是速度问题,是一个沟通和实时过程的问题

#4


0  

If you're in regular need of asynchronous data transmission I'd say you should try out websockets, it's really easy to use. One problem is - because of the early stage - the websocket interface might change (which has happended already) and render your web application unusable until you update your code.

如果你经常需要异步数据传输我会说你应该尝试使用websockets,它真的很容易使用。一个问题是 - 由于早期阶段 - websocket接口可能会发生变化(已经发生了变化)并且在您更新代码之前使Web应用程序无法使用。

#5


0  

Definitely WebSockets!. During my last internship, we used WebSockets together with Erlang to build a chat app for feature phones. Not only was it resource-efficient, it was also faster, and really realtime - connections are always open, until either end closes.

绝对是WebSockets!在我上次实习期间,我们将WebSockets与Erlang一起使用,为功能手机构建聊天应用程序。它不仅资源效率高,而且速度更快,而且非常实时 - 连接始终是开放的,直到任何一端关闭。

And oh, they are experimental but works well on Chrome, Firefox, Android and iOS. The only problem was with parsing data with BB which was because of the library we were using, so we rewrote the library's data parsing algorithm and it worked. We tested on only these platforms.

哦,它们是实验性的,但在Chrome,Firefox,Android和iOS上运行良好。唯一的问题是用BB解析数据是因为我们使用的是库,所以我们重新编写了库的数据解析算法并且它有效。我们只测试了这些平台。

You can checkout Socket.IO which improves upon the raw implementation of WebSockets. Visit this link for some quick demos: http://socket.io/#how-to-use

您可以签出Socket.IO,它改进了WebSockets的原始实现。请访问此链接以获取一些快速演示:http://socket.io/#how-to-use

#1


3  

It's two different technology things. With AJAX client just send request to server and wait to response. Websocket is HTML5 implementation for Comet technology, the idea is push information from server to client.

这是两种不同的技术。使用AJAX客户端只需向服务器发送请求并等待响应。 Websocket是Comet技术的HTML5实现,其思路是从服务器到客户端的推送信息。

#2


1  

Ajax is slower because the overhead. But Ajax is more compatible, Websocket is currently a bit experimental and it is not widely supported by most browser.

Ajax因为开销较慢。但Ajax更兼容,Websocket目前有点实验性,并没有得到大多数浏览器的广泛支持。

#3


0  

I think is not a issue of speed, is a issue of comunication and real time process

我认为不是速度问题,是一个沟通和实时过程的问题

#4


0  

If you're in regular need of asynchronous data transmission I'd say you should try out websockets, it's really easy to use. One problem is - because of the early stage - the websocket interface might change (which has happended already) and render your web application unusable until you update your code.

如果你经常需要异步数据传输我会说你应该尝试使用websockets,它真的很容易使用。一个问题是 - 由于早期阶段 - websocket接口可能会发生变化(已经发生了变化)并且在您更新代码之前使Web应用程序无法使用。

#5


0  

Definitely WebSockets!. During my last internship, we used WebSockets together with Erlang to build a chat app for feature phones. Not only was it resource-efficient, it was also faster, and really realtime - connections are always open, until either end closes.

绝对是WebSockets!在我上次实习期间,我们将WebSockets与Erlang一起使用,为功能手机构建聊天应用程序。它不仅资源效率高,而且速度更快,而且非常实时 - 连接始终是开放的,直到任何一端关闭。

And oh, they are experimental but works well on Chrome, Firefox, Android and iOS. The only problem was with parsing data with BB which was because of the library we were using, so we rewrote the library's data parsing algorithm and it worked. We tested on only these platforms.

哦,它们是实验性的,但在Chrome,Firefox,Android和iOS上运行良好。唯一的问题是用BB解析数据是因为我们使用的是库,所以我们重新编写了库的数据解析算法并且它有效。我们只测试了这些平台。

You can checkout Socket.IO which improves upon the raw implementation of WebSockets. Visit this link for some quick demos: http://socket.io/#how-to-use

您可以签出Socket.IO,它改进了WebSockets的原始实现。请访问此链接以获取一些快速演示:http://socket.io/#how-to-use