Google Channel API 双向套接字是否存在?
在 Google Channel API 的文档中,它说:
“通道是一种单向通信路径,服务器通过该路径将更新发送到由其客户端 ID 标识的特定 JavaScript 客户端。”
在他们的图表中,他们显示了客户端通过 POST 发送其状态。这看起来会很慢。客户端可以通过套接字与 Channel API 进行通信吗?还是必须通过POST发送?
In the docs for the Google Channel API it says:
"A channel is a one-way communication path through which the server sends updates to a specific JavaScript client identified by its Client ID."
In their diagrams they show a client sending its state with a POST. This seems like it would be slow. Can the client communicate with the Channel API through a socket? Or must it send via POST?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
POST是消息类型指示符和消息格式。
经过更多研究后进行重大编辑!
请参阅 Google API 文档
看起来像是从浏览器到服务器的消息确实打开新的 HTTP 级连接来发送 POST 消息。是否需要新的 TCP/IP 连接取决于浏览器对 TCP 连接的管理——新的浏览器在这方面做得更好。请参阅 wikipedia HTTP 持久连接
回复:
这似乎会很慢。
通常浏览器流量是不对称的——大部分数据从服务器传输到浏览器。 Comet 将帮助该用例。Re:
客户端可以通过套接字与 Channel API 通信吗?
你是说 IP 套接字吗?浏览器没有相应的 API。您的意思是“网络套接字”吗?我 98% 确信将这两种技术结合起来是行不通的。但你可以尝试...POST is a message type indicator and message format.
Major edit after more research!
See Google API doc
Looks like messages from the browser to the server do indeed open new HTTP-level connections to send a POST message. Whether a new TCP/IP connection is needed or not depends on the browser's management of TCP connections--new browsers do a better job of this. See wikipedia HTTP persistent connection
Re:
This seems like it would be slow.
Usually the browser traffic is asymmetrical--with most of the data from the server to the browser. Comet will help that use case.Re:
Can the client communicate with the Channel API through a socket?
Do you mean IP socket? Browsers don't have an api for that. Do you mean "web socket?" I'm 98% sure it wouldn't work to combine the two techniques. But you could try...