Please correct me if this question is a duplicate. Regarding node.js, I'm using socket.io for real-time socket connection from the client application to the server application. I just heard about engine.io, is engine.io a replacement for socket.io? I could not find any useful information on engine.io website
如果这个问题是重复的,请纠正我。关于节点。js,我使用套接字。io用于客户端应用程序到服务器应用程序的实时套接字连接。我刚听说了引擎。io,引擎。我可以替换足球吗?我找不到任何关于发动机的有用信息。io网站
Thanks in advance
谢谢提前
4 个解决方案
#1
84
engine.io is a lower level library than socket.io.
引擎。io是一个较低级别的库。
Engine is to Socket.IO what Connect is to Express.
引擎是套接字。沟通就是表达。
If you want the lower level abstraction, use engine.io. If you want a websocket abstraction, keep using socket.io.
如果您想要更低的抽象级别,请使用engine.io。如果您想要一个websocket抽象,继续使用socket.io。
engine.io is of more interest to you if you're building a library/framework on top of socket.io.
引擎。如果您正在socket.io之上构建一个库/框架,那么io会对您更感兴趣。
socket.io is of more interest to you if you're building an application on top of socket.io.
套接字。如果您是在socket.io之上构建应用程序,io会更让您感兴趣。
#2
19
socket.io is built on top of engine.io.
套接字。io是在工程的基础上建造的。
socket.io is engine.io with bells and whistles.
套接字。io是引擎。有铃铛和口哨。
if you don't need everything socket.io has (redis store, groups, etc.) just use engine.
如果你不需要所有的插座。io只需要使用引擎(redis store, group等)。
#3
14
A bit late to the game :-), but I'll mention it here for posterity.
这个游戏有点晚了:-),但是我要在这里说给后人听。
Aside from being "lower level", one of the most important differences is socket.io will start with websockets first & degrade until it finds a transport that can work. On the other hand, engine.io will start with short polling (and upgrade on the side until it hits a wall).
除了“较低的层次”,最重要的区别之一是插座。io将首先从websockets开始&降级,直到它找到一个可以工作的传输。另一方面,引擎。io将从短轮询开始(并在一边进行升级,直到它撞上墙壁)。
Why?
为什么?
From the user perspective, an unsuccessful WebSocket connection can translate in up to at least 10 seconds of waiting for the realtime application to begin exchanging data. This perceptively hurts user experience.
从用户的角度来看,未成功的WebSocket连接至少需要10秒的时间来等待实时应用程序开始交换数据。这明显地伤害了用户体验。
At the moment (2013), websockets isn't pervasive yet (e.g. older browsers, cellular networks, etc.) so it's smart to start with the XHR 1st.
目前(2013年),websockets还没有普及(比如旧的浏览器、蜂窝网络等等),所以从XHR 1开始就很聪明了。
See https://github.com/LearnBoost/engine.io (Goals section) for more info.
更多信息请参见https://github.com/LearnBoost/engine.io(目标部分)。
#4
7
Socket.IO v0.9 is outdated and a bit buggy, and Engine.IO is the interim successor. Socket.IO v1.0 (which will be released soon) will use Engine.IO and be much better than v0.9.
套接字。IO v0.9已经过时了,有点问题,还有引擎。IO是临时继任者。套接字。IO v1.0(即将发布)将使用Engine。IO比v0.9要好得多。
In my tests, Engine.IO appeared to perform better than Socket.IO v0.9, see the comparison: https://medium.com/node-js-javascript/b63bfca0539
在我的测试中,引擎。IO的表现比Socket要好。IO v0.9,见比较:https://medium.com/node-js-javascript/b63bfca0539
Socket.IO tries to reconnect for some time after connection is lost, whereas Engine.IO does not.
套接字。IO尝试在连接丢失后重新连接一段时间,而不是引擎。IO不。
Socket.IO supports rooms whereas Engine.IO does not. You would need rooms (either via these modules or your own implementation) if you'll have connections listening to different data/channel.
套接字。IO支持房间而不是引擎。IO不。如果您有连接监听不同的数据/通道,您将需要房间(通过这些模块或您自己的实现)。
#1
84
engine.io is a lower level library than socket.io.
引擎。io是一个较低级别的库。
Engine is to Socket.IO what Connect is to Express.
引擎是套接字。沟通就是表达。
If you want the lower level abstraction, use engine.io. If you want a websocket abstraction, keep using socket.io.
如果您想要更低的抽象级别,请使用engine.io。如果您想要一个websocket抽象,继续使用socket.io。
engine.io is of more interest to you if you're building a library/framework on top of socket.io.
引擎。如果您正在socket.io之上构建一个库/框架,那么io会对您更感兴趣。
socket.io is of more interest to you if you're building an application on top of socket.io.
套接字。如果您是在socket.io之上构建应用程序,io会更让您感兴趣。
#2
19
socket.io is built on top of engine.io.
套接字。io是在工程的基础上建造的。
socket.io is engine.io with bells and whistles.
套接字。io是引擎。有铃铛和口哨。
if you don't need everything socket.io has (redis store, groups, etc.) just use engine.
如果你不需要所有的插座。io只需要使用引擎(redis store, group等)。
#3
14
A bit late to the game :-), but I'll mention it here for posterity.
这个游戏有点晚了:-),但是我要在这里说给后人听。
Aside from being "lower level", one of the most important differences is socket.io will start with websockets first & degrade until it finds a transport that can work. On the other hand, engine.io will start with short polling (and upgrade on the side until it hits a wall).
除了“较低的层次”,最重要的区别之一是插座。io将首先从websockets开始&降级,直到它找到一个可以工作的传输。另一方面,引擎。io将从短轮询开始(并在一边进行升级,直到它撞上墙壁)。
Why?
为什么?
From the user perspective, an unsuccessful WebSocket connection can translate in up to at least 10 seconds of waiting for the realtime application to begin exchanging data. This perceptively hurts user experience.
从用户的角度来看,未成功的WebSocket连接至少需要10秒的时间来等待实时应用程序开始交换数据。这明显地伤害了用户体验。
At the moment (2013), websockets isn't pervasive yet (e.g. older browsers, cellular networks, etc.) so it's smart to start with the XHR 1st.
目前(2013年),websockets还没有普及(比如旧的浏览器、蜂窝网络等等),所以从XHR 1开始就很聪明了。
See https://github.com/LearnBoost/engine.io (Goals section) for more info.
更多信息请参见https://github.com/LearnBoost/engine.io(目标部分)。
#4
7
Socket.IO v0.9 is outdated and a bit buggy, and Engine.IO is the interim successor. Socket.IO v1.0 (which will be released soon) will use Engine.IO and be much better than v0.9.
套接字。IO v0.9已经过时了,有点问题,还有引擎。IO是临时继任者。套接字。IO v1.0(即将发布)将使用Engine。IO比v0.9要好得多。
In my tests, Engine.IO appeared to perform better than Socket.IO v0.9, see the comparison: https://medium.com/node-js-javascript/b63bfca0539
在我的测试中,引擎。IO的表现比Socket要好。IO v0.9,见比较:https://medium.com/node-js-javascript/b63bfca0539
Socket.IO tries to reconnect for some time after connection is lost, whereas Engine.IO does not.
套接字。IO尝试在连接丢失后重新连接一段时间,而不是引擎。IO不。
Socket.IO supports rooms whereas Engine.IO does not. You would need rooms (either via these modules or your own implementation) if you'll have connections listening to different data/channel.
套接字。IO支持房间而不是引擎。IO不。如果您有连接监听不同的数据/通道,您将需要房间(通过这些模块或您自己的实现)。