插座之间有什么区别。IO和websockets在
node . js ?
它们都是服务器推送技术吗?
我觉得唯一的不同是,
套接字。IO允许我通过指定事件名称来发送/发出消息。
对于socket。io消息从服务器将到达所有客户端,但同样在websockets,我被迫保持一个数组的所有连接和循环通过它发送消息到所有客户端。
同时,
我想知道为什么网络检查员(如Chrome/firebug/fiddler)无法从服务器捕捉这些消息(从socket.io/websocket) ?
请澄清这一点。
TLDR:
的套接字。Io '是一个应用层规范,可以在/使用应用层规范'websockets'之上实现。
websocket规范
套接字。io规范
我认为简单的答案是在基本的web技术定义中:
Specification: A documented standard detailing the requirements for a program to achieve in order to be labeled as "an implimentation of some sepc." It is important to achieve this rubber stamp when building programs, because any program is only as good at the machine executing the code. Programming is fundamentally built upon specifications, and if, they are not followed code will not execute correctly. However, a specification does nothing. It is just a text document.
Implementation: This is actual, executable code that accomplishes what the specification says to do.
Application Layer - System that defines messages and handshakes sent over transport. This is the stuff you have to know when working with HTTP/Websockets/Socketio. It defines how the connections will be made, authenticated, data will be sent, and how it will arrive.