0

I have an intranet based CRM application developed in CodeIgniter 2.1 where the application is running on a local Apache server and around 20 clients are accessing it over LAN. This is to be connected to a call center setup where the call center application (running on a separate server) will do a HTTP post with caller's number as well as terminal number of the agent where the call is arriving to a URL of my Codeigniter application. I am using this data to populate a database table of call records.

Now from the terminal number (each terminal has static IP, and a session in Codeigniter is linked to IP as well) I can find out which user (login session) of my application is about to receive the call. I want to find a way out how I can send data from server side (it will be regarding the call like the number who is calling, past call records etc.) to that specific user's browser via AJAX or something similar? The agent's browser needs to display this information sent from server. Periodic polling from browser by jquery etc. is not possible as the data needs to be updated almost instantaneously and rapid polling up to this extent will lead to high CPU usage at client end as well as extra load on network.

P.S.: I only want to know how to modify the browser data from server end.

4

1 回答 1

1

在 AJAX 中,异步请求/响应不涉及轮询;只有一个开放的 TCP 连接和非阻塞 I/O。客户端发出请求但立即返回;当服务器发送响应时,会通知客户端。因此,您可以使用 AJAX 的 XMLHttpRequest 实现您想要的,而无需轮询[1]。您所需要的只是一个用于提供通知的 URL。你可以有一个请求线程和一个通用的调度方法,或者每个都有不同的 url 和不同的线程,这取决于你需要如何扩展。

[1] 好吧,老实说,投票很少。您确实需要确定会话/全局超时是什么,并在该时间限制内重新发出请求。

于 2012-09-30T16:22:49.793 回答