CN102629908B - Data real-time calling method of WEB server - Google Patents
Data real-time calling method of WEB server Download PDFInfo
- Publication number
- CN102629908B CN102629908B CN201210081792.0A CN201210081792A CN102629908B CN 102629908 B CN102629908 B CN 102629908B CN 201210081792 A CN201210081792 A CN 201210081792A CN 102629908 B CN102629908 B CN 102629908B
- Authority
- CN
- China
- Prior art keywords
- web server
- event
- database
- request
- time
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Abstract
The invention discloses a data real-time calling method of a WEB server, which comprises the steps as follows: a trigger module is arranged in a database, and the trigger condition is that the information of a communication server is received or the time of keeping link is set to be 30s; the personnel at the seat end accesses the WEB server and sends a request by an Internet network; and the WEB server receives the request to call an event message from the database, wherein three conditions exist. According to the invention, the request data is sent once every 3s to every 30s, so that the space and data flow are saved; and when a CTI (computer telephony integration) server sends the event message to the database, the WEB server immediately sends the event message to the personnel at the seat end by the Internet network, so that the real-time property and high efficiency of the event are realized.
Description
Technical field
The present invention relates to communication technical field, particularly relate to a kind of WEB server data real-time calling method.
Background technology
Existing WEB server data calling method is, as Fig. 1: seat end uses computer to connect WEB server by Internet network, WEB server and the middle connection data storehouse of cti server; Event stores in a database by cti server, and seat end uses computer within every 3 seconds, to go data base call once by Internet network, and in 3 seconds, when there being event, WEB server is called event and waited until the 3rd second and returns seat end computer from database; When there is no event, also waiting until the 3rd second, returning without event signal;
No matter whether this kind of WEB server data calling method, have event, and within every 3 seconds, call once, flexibility is low, poor real, and the occupancy of frequency range is high, thus form cost waste.
Summary of the invention
The present invention proposes a kind of WEB server data real-time calling method, can be real-time from database, call event information;
The concrete steps of the method are:
Database is provided with trigger module, and trigger condition is that to receive the time that the information of the communication server or setting maintain link be 30 seconds;
1. seat end personnel connect WEB server by Internet network, send request;
2.WEB server receives request and removes data base call event information, point four kinds of situations:
A., within 30 second time, if database does not receive the event information that cti server sends, then, when 30 second time arrived, WEB server sends without event information by Internet network to seat end personnel;
If b. while database receives WEB server solicited message, database receives the event information that cti server sends simultaneously, and WEB server then sends event information by Internet network to seat end personnel immediately;
If after c. database receives WEB server solicited message 30-n second, 0 < n≤30, n is arbitrary value, cti server sends event information to database, and WEB server then sends event information by Internet network to seat end personnel at 30-n second;
If d. within 30 second time, database returns in event timeout or return data wrong, perform event timeout or exception, first close the long of last time and connect, stop current event, then carry out disconnection reconnecting, again accept WEB server request.
Beneficial effect of the present invention:
1. send a request msg from every 3 seconds to every 30 seconds, save space and data flow;
2., when cti server sends event information to database, WEB server then sends event information by Internet network to seat end personnel immediately, and achieve the real-time of event, efficiency is high.
Accompanying drawing explanation
Fig. 1 is existing WEB server data calling method;
Fig. 2 is schematic flow sheet of the present invention;
Embodiment
To develop simultaneously embodiment below in conjunction with accompanying drawing, describe the present invention.
The invention provides a kind of WEB server data real-time calling method, can be real-time from database, call event information;
The concrete steps of the method are:
Database is provided with trigger module, and trigger condition is that to receive the time that the information of the communication server or setting maintain link be 30 seconds;
1. seat end personnel connect WEB server by Internet network, send request;
2.WEB server receives request and removes data base call event information, point four kinds of situations:
A., within 30 second time, if database does not receive the event information that cti server sends, then, when 30 second time arrived, WEB server sends without event information by Internet network to seat end personnel;
If b. while database receives WEB server solicited message, database receives the event information that cti server sends simultaneously, and WEB server then sends event information by Internet network to seat end personnel immediately;
If after c. database receives WEB server solicited message 30-n second, 0 < n≤30, n is arbitrary value, cti server sends event information to database, and WEB server then sends event information by Internet network to seat end personnel at 30-n second;
If d. within 30 second time, database returns in event timeout or return data wrong, perform event timeout or exception, first close the long of last time and connect, stop current event, then carry out disconnection reconnecting, again accept WEB server request.
Analyze below in conjunction with embodiment:
The implementation model of seat client is the mode by the long poll (long-polling) based on AJAX.
First Client end sends Ajax request to Server end, sets up long connection.The request of Server end process Client end, until there are data to need to return (having event), or wait timeout (without event), Server end will hold return data to Client.The data that Client holds treatment S erver to return, after having processed, send Ajax request to Server end again.
The method mainly consider in the design following some:
1.C language feature and advantage
C language is a kind of computer programming language.It had both had the feature of high-level language, again there is the features such as high-performance, in the execution efficiency of server programming overriding concern program, compare the language such as java, php, C directly can use Installed System Memory, the API directly calling more bottom also just makes to use C language coding flexible and efficient, and thing followed shortcoming is exactly need careful control routine quality.
2. realize http long connection server end code basic structure;
3.epoll mode is introduced
Epoll is
linux kernelfor processing the poll that handle in enormous quantities has been done to improve, be the enhancing version of multiplexed I/O interface select/poll under Linux, it can significantly reduce program only have in a large amount of concurrent connection a small amount of active system CPU utilance.
Epoll is particularly suitable in the system of Large Copacity short-time duty, and because call center needs support 2000 seat Concurrency Access, we adopt epoll mechanism.
The handling process of the method is:
0. seat client logs, sends to bottom and logs in Login operation;
After seat logins successfully, perform telephony initialization Phone.init (), send long connection request (pollEvent) to bottom, set up long connection; The wherein long connection event code of seat client: phone.js
login->init->pollEvent<->pushEvent->eventTimeout->login
1. bottom layer treatment request, waiting event (as ring ringing, init state initstatus etc.), if without any event after 30 seconds, returns and keeps heartbeat to connect keeplive event;
2. the propelling movement event (pushEvent) that returns of seat client process bottom, completes follow-up supervention and send long connection request pollEvent, then performs the 2nd step;
If 3. bottom returns in event timeout or return data wrong, perform event timeout or abnormal enventTimout, first close the long of last time and connect (dieEvent), stop current event, then carry out disconnection reconnecting, perform step 0;
4. exit seat client, perform and stop current event dieEvent, close long connection;
Key code is resolved and is comprised:
Mainly contain three functions, send Ajax request to bottom: pollEvent;
Treated Base returns and then sends request: pushEvent;
Process abnormal and overtime, disconnection reconnecting: eventTimeout
1. client sends request to bottom
This.xhrEvent.get () is that client sends AJAX request to bottom, in this.xhrEvent.get (), four parameters respectively: the URL of request, ask successful call back function pushEvent, failed call back function eventError and the call back function oTimeout of request timed out, time-out time is 35 seconds.Wherein eventError and oTimeout finally can call eventTimeout function.
URL form is as follows:
http://172.16.203.179:8080/hotline/requestaction/?action=waiteve
nt&accountno=861000000&username=2000&password=e10adc3949ba59abbe56e0
57f20f883e&time=1329967593287
2. bottom request is successfully adjusted back
If bottom has event to return or bottom wait timeout, will adjust back pushEvent function, this function is equivalent to the reception of long connection event.First in pushEvent, a series of inspection is carried out to return data, if return data is incorrect, calls eventTimeout function and carry out disconnection reconnecting, if data are correct, then can call corresponding event handling function according to the event difference of returning: obj_evt [newEvt.toLowerCase ()]; Wherein obj_evt is the array of call back function, and key is function name.
After finally processing bottom event, in pushEvent, again send pollEvent, send request to bottom.
3. bottom request timed out and failed readjustment
If send long connection event time-out or wrong generation, disconnection reconnecting function eventTimeout will be called.The long connection before being stopping mainly being operated in eventTimeout, again login request is sent to bottom, set up new connection, if again there is time-out or mistake in reconnect procedure, then can eject disconnection reconnecting prompting frame in seat client, shielding user operation, and then send login request, until reconnect successfully, prompting frame disappears automatically.
4, data format
The data format that long connection event returns is XML
In sum, these are only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.
Claims (3)
1. a WEB server data real-time calling method, seat end uses computer to connect WEB server by Internet network, WEB server and the middle connection data storehouse of computer telephone integration cti server, it is characterized in that, database is provided with trigger module, and trigger condition is that to receive the time that the information of the communication server or setting maintain link be 30 seconds;
The first step: seat end personnel connect WEB server by Internet network, send request;
Second step: WEB server receives request and removes data base call event information, point four kinds of situations:
A., within 30 second time, if database does not receive the event information that cti server sends, then, when 30 second time arrived, WEB server sends without event information by Internet network to seat end personnel;
If b. while database receives WEB server solicited message, database receives the event information that cti server sends simultaneously, and WEB server then sends event information by Internet network to seat end personnel immediately;
If after c. database receives WEB server solicited message 30-n second, in 0 < n≤30 scope, n is arbitrary value, cti server sends event information to database, and WEB server then sends event information by Internet network to seat end personnel at this 30-n second;
If d. within 30 second time, database returns in event timeout or return data wrong, perform event timeout or exception, first close the long of last time and connect, stop current event, then carry out disconnection reconnecting, again accept WEB server request.
2. a kind of WEB server data real-time calling method as claimed in claim 1, is characterized in that: concrete implementing procedure is:
Step one, seat client logs, send register to bottom;
After step 2, seat login successfully, perform telephony initialization, send long connection request to bottom, set up long connection;
Step 3, bottom layer treatment request, waiting event, if without any event after 30 seconds, returns and keeps heartbeat connection event;
The propelling movement event that step 4, seat client process bottom return, completes follow-up supervention and send long connection request, then perform step 2;
If step 5 bottom returns in event timeout or return data wrong, perform event timeout or exception, first close the long of last time and connect, stop current event, then carry out disconnection reconnecting, perform step one;
Step 6, exit seat client, perform and stop current event, close long connection.
3. a kind of WEB server data real-time calling method as claimed in claim 2, is characterized in that: the long connection event code of described seat client is phone.js login->init->pollEventLEssT. LTssT.LT->pushEvent->eventTi meout->login.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210081792.0A CN102629908B (en) | 2012-03-24 | 2012-03-24 | Data real-time calling method of WEB server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210081792.0A CN102629908B (en) | 2012-03-24 | 2012-03-24 | Data real-time calling method of WEB server |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102629908A CN102629908A (en) | 2012-08-08 |
CN102629908B true CN102629908B (en) | 2015-05-20 |
Family
ID=46588069
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210081792.0A Active CN102629908B (en) | 2012-03-24 | 2012-03-24 | Data real-time calling method of WEB server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102629908B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103167017B (en) * | 2013-01-09 | 2016-06-29 | 北京奇虎科技有限公司 | Web polling method, Apparatus and system |
CN109087412A (en) * | 2018-06-06 | 2018-12-25 | 咕咚网络(北京)有限公司 | The connection method of door lock terminal and gateway in a kind of Wireless Networking door-locking system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1725689A (en) * | 2004-07-22 | 2006-01-25 | 中兴通讯股份有限公司 | Telecommunication network calling centre system and its implementing method |
CN101262523A (en) * | 2008-04-29 | 2008-09-10 | 上海汉傲电信科技有限公司 | A call center and its implementation method |
CN101924842A (en) * | 2009-06-10 | 2010-12-22 | 中兴通讯股份有限公司 | Computer telecommunication integration equipment and resource managing and incoming call controlling method |
-
2012
- 2012-03-24 CN CN201210081792.0A patent/CN102629908B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1725689A (en) * | 2004-07-22 | 2006-01-25 | 中兴通讯股份有限公司 | Telecommunication network calling centre system and its implementing method |
CN101262523A (en) * | 2008-04-29 | 2008-09-10 | 上海汉傲电信科技有限公司 | A call center and its implementation method |
CN101924842A (en) * | 2009-06-10 | 2010-12-22 | 中兴通讯股份有限公司 | Computer telecommunication integration equipment and resource managing and incoming call controlling method |
Also Published As
Publication number | Publication date |
---|---|
CN102629908A (en) | 2012-08-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108712485B (en) | Resource subscription method and device for Internet of things equipment | |
CN103685741B (en) | The method and system that a kind of mobile terminal single-sign-on and single-point are nullified | |
CN105184945B (en) | The method, apparatus and system and server-side of a kind of queuing number-taking | |
CN1825854A (en) | Event notification method in wireless communication system | |
CN104601445A (en) | Message handling method, device, terminal and server | |
CN110764881A (en) | Distributed system background retry method and device | |
CN102333164B (en) | Incoming call screen display method of call system based on B/S (Browser/Server) framework | |
CN104333663A (en) | Mobile terminal and control method thereof | |
CN113472889A (en) | Scheduling system and method of microservice | |
CN104335614A (en) | Mechanism for facilitating dynamic real-time customization of messaging for computing systems | |
CN102629908B (en) | Data real-time calling method of WEB server | |
US9106596B2 (en) | Method and apparatus of configuring a data broadcast service | |
CN113993092B (en) | Emergency call method and device, mobile terminal and network equipment | |
CN101551758A (en) | System and method for implementing paralleling work of device management and tasks | |
CN106331386B (en) | SOT state of termination synchronous method, relevant apparatus and system | |
CN103200591A (en) | Method for processing mobile network call requests | |
CN107306290B (en) | Session sharing method and application server | |
CN103347038A (en) | Method of WEB server for processing http messages | |
CN105635205A (en) | Message push method and system of intelligent mobile equipment | |
CN105631573A (en) | Overall planning service method used for large-scale consumption place | |
CN202535375U (en) | WEB server data real-time calling apparatus | |
CN112202701B (en) | Data processing method, device, server, terminal, system and storage medium | |
CN113992793B (en) | Communication method and device and electronic equipment | |
CN113821327A (en) | Instance scheduling method, system and computing equipment | |
CN108566477B (en) | Address book updating method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C56 | Change in the name or address of the patentee | ||
CP01 | Change in the name or title of a patent holder |
Address after: 100176, No. 5, building 18, North tech software park, 1 Bei Sheng North Street, Yizhuang economic and Technological Development Zone, Beijing, Daxing District Patentee after: Beijing Tianrun financing Polytron Technologies Inc Address before: 100176, No. 5, building 18, North tech software park, 1 Bei Sheng North Street, Yizhuang economic and Technological Development Zone, Beijing, Daxing District Patentee before: Beijing Tianrun Rongtong Technology Co., Ltd. |