且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

可以Web服务器发送数据,而无需从客户端的请求?

更新时间:2023-08-31 19:48:28

您可以使用网络套接字这是客户端和服务器之间的双向沟通​​是保持开放,并允许发送服务器而无需客户端的请求。然而网络插座新的浏览器支持仅适用于最新的浏览器。

You can use web-sockets which are two way communication between client and server that remain open and allow the server to send without request from the client. However web-sockets are new and browser support is only for the most current browsers.

socket.io 是为网络插座有落差背对着AJAX和一个伟大的图书馆,如果不支持他们闪烁。

socket.io is a great library for web sockets with fall backs to AJAX and flash if they are not supported.

除此之外的唯一的其他方式为服务器将数据发送到客户端是后客户已经发送一个请求。有使用AJAX轮询从客户端的方法来检查来自服务器的更新。

Other than that the only other way for the server to send data to the clients is after the client has sent a request. There is methods using AJAX polling from the client to check for updates from the server.