jQuery和放大器; PHP的 - 我可以把从服务器?放大器、服务器、jQuery、PHP

2023-09-10 16:22:39 作者:走死在岁月里

我刚开始看的JQuery;到现在为止一切都已经PHP。

I am just starting to look at JQuery; until now everything has been PHP.

只是好奇:如果服务器检测到事件,并希望更新用户的浏览器,我可以做服务器推送,还是客户端必须轮询

Just curious: if the server detects an event and wants to update the user's browser, can I do server push, or does the client have to poll?

推荐答案

客户端必须查询,但你可以做的长轮询,即保持请求活着,直到该服务器有一个事件的推背(即完整的要求)。

Client has to poll, but you can do long polling, i.e. keep the request alive until the server has an event to push back (i.e. complete request).

否则,您可以使用网络套接字。

Otherwise, you can use Web Sockets.