TCP 服务器将数据推送到 Web 浏览器

发布于 2024-09-05 17:07:46 字数 207 浏览 1 评论 0原文

我有一个 TCP 服务器,它通过 Web 浏览器连接到网页。网页通过Web浏览器向TCP服务器发送请求很容易,但是有没有一种方法TCP服务器可以将数据推送到Web浏览器,而不需要等待浏览器端的请求? < /strong> 我最初的想法是这是不可能的,因为浏览器是无状态的。但有人告诉我有办法做到这一点......有什么想法吗?

谢谢你!!

I have a TCP server, which is connected to a web page via a Web browser. It is easy to send a request to the TCP server by the web page via the Web Browser, but is there a way that TCP server can push data to the web browser, without waiting for a request from browser side?? My initial idea was that this is impossible, since a browser is stateless. But I was told there are ways to do that... Any ideas?

Thank You!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

不爱素颜 2024-09-12 17:07:47

您需要实验性 HTML 5 Websockets,请参阅幻灯片了解其想法或其他服务器推送内容

You'll need the experimental HTML 5 Websockets see slides for the idea, or other server push stuff

暗喜 2024-09-12 17:07:47

据我所知, WebHooksComet 是将数据从服务器推送到客户端的唯一方法,同时仍然使用 HTTP。看看它们是否是您要找的:)。

更新

尝试 websockets(使用 socket.io,如果可用)。另外,请查看 meteor 获取灵感。

From what I know, WebHooks and Comet are the only ways to push data from the server to the client, while still using HTTP. See if they're what you're looking for :).

Update

Try websockets (with socket.io, if that's available). Also, check out meteor for inspiration.

夜无邪 2024-09-12 17:07:47

是 使用(网络)流将数据写入网络服务器

yes use the (network)stream to write data to the webserver

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文