网页数据更新系统及方法 Webpage data update system and method
技术领域 Technical field
本发明涉及互联网领域, 尤其涉及一种网页数据更新系统及方法。 发明背景 The present invention relates to the field of the Internet, and in particular, to a webpage data updating system and method. Background of the invention
网络即时通讯软件出现了群, 发展至今, 群已经成为用户必不可少 的使用工具。 目前, 群会话已经从筒单的多人会话发展成了好友关系链 的延伸, 因此, 用户对群以及群内群友信息的关注度增强。 群动态为提 供了丰富而多元化的群信息的平台, 群动态的实时更新非常重要。 而群 动态作为内嵌网页的一种, 具有网页技术上的局限性, 即网页上的内容 和数据是通过超文本传输协议 ( Http, HyperText Transfer Protocol ) 向 Web服务器请求后得来的, 而 Http协议不能在没有浏览器 Web请求的 时候主动向 Web实时推送信息。 Network instant messaging software has emerged as a group, and since its inception, the group has become an indispensable tool for users. At present, group conversations have evolved from a multi-person conversation in a single order to an extension of a friendship relationship chain. Therefore, the user's attention to the group and group friends information in the group is enhanced. Group dynamics provides a platform for rich and diverse group information, and real-time updates of group dynamics are very important. As a kind of embedded webpage, group dynamics has the limitation of webpage technology, that is, the content and data on the webpage are obtained by requesting the web server through Hypertext Transfer Protocol (Http, Http, Http The protocol cannot actively push information to the Web in real time without a browser web request.
目前,要使 Web服务器的更新快速在网页响应,可以在网页中通过 脚本语言设置定时器, 定时向 Web服务器发起请求, 如果 Web服务器 有更新就会返回更新信息。但由于需要定时向 Web服务器发起请求, 因 此浪费了带宽, 并增加了 Web服务器的压力; 而且, 若定时间隔设置太 长, 也不能实现太好的实时效果。 发明内容 At present, in order to make the update of the web server quickly respond to the webpage, the timer can be set in the webpage through the scripting language, and the request is periodically sent to the web server, and the update information is returned if the web server is updated. However, due to the need to periodically initiate a request to the Web server, bandwidth is wasted and the pressure on the Web server is increased. Moreover, if the timing interval is set too long, too good real-time effects cannot be achieved. Summary of the invention
基于此,有必要提供一种网页数据更新系统, 能减轻 Web服务器和 网络带宽压力, 提高数据更新速度。 Based on this, it is necessary to provide a webpage data update system, which can alleviate the pressure on the web server and network bandwidth, and improve the data update speed.
此外,还有必要提供一种网页数据更新方法, 能减轻 Web服务器和 网络带宽压力, 提高数据更新速度。
一种网页数据更新系统, 所述系统包括: In addition, it is necessary to provide a method for updating webpage data, which can alleviate the pressure on the web server and network bandwidth, and improve the data update speed. A webpage data update system, the system comprising:
Web服务器, 用于记录更新信息并将更新信息传输给通讯服务器; 通讯服务器, 用于接收所述更新信息, 对所述更新信息进行处理, 并将处理后的更新信息通过面向连接的加密协议发送给即时通讯客户 端; a web server, configured to record update information and transmit the update information to the communication server; the communication server is configured to receive the update information, process the update information, and send the processed update information through a connection-oriented encryption protocol To the instant messaging client;
即时通讯客户端, 用于接收所述处理后的更新信息, 并根据所述处 理后的更新信息得到控制信息和更新的内容信息, 根据所述控制信息和 更新的内容信息进行网页更新操作。 The instant messaging client is configured to receive the processed update information, obtain control information and updated content information according to the processed update information, and perform a webpage update operation according to the control information and the updated content information.
优选地, 所述通讯服务器对所述更新信息的处理为打包和加密, 所 述即时通讯客户端包括: Preferably, the processing of the update information by the communication server is packaging and encryption, and the instant messaging client includes:
协议处理器, 用于对接收到的处理后的更新信息进行解密和解析处 理, 得到控制信息和更新的内容信息, 并将所述控制信息和更新的内容 信息传输给网页模块; a protocol processor, configured to decrypt and parse the received processed update information, obtain control information and updated content information, and transmit the control information and the updated content information to the webpage module;
网页模块, 用于创建内嵌网页, 根据所述控制信息和更新的内容信 息进行网页更新操作。 The webpage module is configured to create an embedded webpage, and perform a webpage update operation according to the control information and the updated content information.
优选地, 所述控制信息包括网页更新方式和需更新的网页的标识 号, 所述更新的内容信息包括更新的函数名和参数列表。 Preferably, the control information includes a webpage update mode and an identification number of the webpage to be updated, and the updated content information includes an updated function name and a parameter list.
优选地,所述网页模块通过刷新网页和 /或调用网页的脚本函数对网 页进行更新操作。 Preferably, the webpage module performs an update operation on the webpage by refreshing the webpage and/or calling a script function of the webpage.
优选地, 所述网页的脚本函数的格式包括操作类型、 网页标识号和 数据内容。 Preferably, the format of the script function of the webpage includes an operation type, a webpage identification number, and a data content.
优选地,所述网页模块还用于直接向所述 Web服务器拉取更新的内 容信息对网页进行更新操作。 Preferably, the webpage module is further configured to perform an update operation on the webpage by directly pulling the updated content information to the web server.
一种网页数据更新方法, 包括以下步骤: A method for updating webpage data, comprising the following steps:
A. 记录更新信息并将更新信息发送出去;
B. 接收该更新信息, 对更新信息进行处理, 并将处理后的更新信 息通过面向连接的加密协议发送给即时通讯客户端; A. Record the update information and send the update information; B. receiving the update information, processing the update information, and sending the processed update information to the instant messaging client through a connection-oriented encryption protocol;
C. 所述即时通讯客户端接收处理后的更新信息, 并根据所述处理 后的更新信息得到控制信息和更新的内容信息, 根据所述控制信息和更 新的内容信息进行网页更新操作。 C. The instant messaging client receives the processed update information, and obtains control information and updated content information according to the processed update information, and performs a webpage update operation according to the control information and the updated content information.
优选地, 所述对更新信息进行处理包括: 对所述更新信息进行打包 和加密; Preferably, the processing the update information comprises: packaging and encrypting the update information;
所述根据所述处理后的更新信息得到控制信息和更新的内容信息 包括: 对所述处理后的更新信息进行解密和解析处理, 得到控制信息和 更新的内容信息。 The obtaining the control information and the updated content information according to the processed update information comprises: decrypting and parsing the processed update information to obtain control information and updated content information.
优选地, 所述控制信息包括网页更新方式和需更新的网页的标识 号; 所述更新的内容信息包括更新的函数名和参数列表。 Preferably, the control information includes a webpage update mode and an identification number of the webpage to be updated; the updated content information includes an updated function name and a parameter list.
优选地, 所述网页更新操作具体是: 通过刷新网页和 /或调用网页的 脚本函数对网页进行更新操作。 Preferably, the webpage update operation is specifically: performing an update operation on the webpage by refreshing the webpage and/or calling a script function of the webpage.
优选地, 所述网页的脚本函数的格式包括操作类型、 网页标识号和 数据内容。 Preferably, the format of the script function of the webpage includes an operation type, a webpage identification number, and a data content.
优选地, 所述方法还包括: 所述即时通讯客户端直接拉取所述更新 的内容信息对网页进行更新操作。 Preferably, the method further includes: the instant messaging client directly pulling the updated content information to perform an update operation on the webpage.
上述网页数据更新系统及方法中, 将更新信息通过通讯服务器处理 后通过面向连接的加密协议发送给即时通讯客户端, 即时通讯客户端中 的协议处理器根据更新信息得到控制信息和数据信息, 并根据控制信息 和数据信息进行网页更新操作, 不用定时发送请求信息, 减轻了 Web 服务器和网络带宽的压力, 即时通讯客户端的网页更新响应也更快速, 操作筒单, 不用复杂的网页脚本, 性能高。 In the above webpage data updating system and method, the update information is sent to the instant messaging client through the connection-oriented encryption protocol after being processed by the communication server, and the protocol processor in the instant messaging client obtains the control information and the data information according to the update information, and The webpage update operation is performed according to the control information and the data information, and the request information is not sent periodically, thereby reducing the pressure on the web server and the network bandwidth, and the webpage update response of the instant messaging client is also faster, the operation is simple, the complicated webpage script is not used, and the performance is high. .
另外, 采用直接从 Web服务器拉取更新的内容信息的方式, 能够使
数据更新更加快速及时, 达到更好的实时更新的效果。 附图简要说明 In addition, by adopting a method of directly extracting updated content information from a web server, it is possible to Data updates are faster and more timely, achieving better real-time updates. BRIEF DESCRIPTION OF THE DRAWINGS
下面将通过参照附图详细描述本发明的示例性实施例, 使本领域的 普通技术人员更清楚本发明的上述及其它特征和优点, 附图中: The above and other features and advantages of the present invention will become more apparent to those skilled in the <
图 1为一个实施例中网页数据更新系统的结构示意图; 1 is a schematic structural diagram of a webpage data update system in an embodiment;
图 2为另一个实施例中即时通讯客户端的结构示意图; 2 is a schematic structural diagram of an instant messaging client in another embodiment;
图 3为一个实施例中网页数据更新方法的流程图。 实施本发明的方式 FIG. 3 is a flow chart of a method for updating webpage data in an embodiment. Mode for carrying out the invention
如图 1所示, 一种网页数据更新系统, 包括 Web服务器 10、 通讯 服务器 20和即时通讯客户端 30。 其中: As shown in FIG. 1, a webpage data updating system includes a web server 10, a communication server 20, and an instant messaging client 30. among them:
Web服务器 10是为即时通讯客户端 30提供更新信息的服务中心, 用于记录更新信息并将更新信息传输给通讯服务器 20。 在一个实施例 中, 如在一个群社区内, Web服务器 10用于记录该群社区发生的事件, 并将更新信息传输给通讯服务器 20。 Web服务器 10可将更新信息通过 内联网中的传输控制协议( TCP , Transmission Control Protocol )的高速 通道传输给通讯服务器 20。 The web server 10 is a service center that provides update information to the instant messaging client 30 for recording update information and transmitting the update information to the communication server 20. In one embodiment, as in a group community, the web server 10 is used to record events that occur in the group community and transmit update information to the communication server 20. The Web server 10 can transmit the update information to the communication server 20 through the high speed channel of the Transmission Control Protocol (TCP) in the intranet.
通讯服务器 20与 Web服务器 10相连,接收更新信息, 并将更新信 息的原始数据进行打包和加密等处理, 再将处理后的更新信息通过面向 连接的加密协议发送给即时通讯客户端 30。 The communication server 20 is connected to the Web server 10, receives the update information, and processes and encrypts the original data of the update information, and then transmits the processed update information to the instant messaging client 30 through the connection-oriented encryption protocol.
其中,通讯服务器 20和即时通讯客户端 30进行通信是基于 TCP协 议或用户数据包协议( UDP, User Datagram Protocol )之上制定的面向 连接的加密协议的, 连接建立后, 通讯服务器 20和即时通讯客户端 30 会保持这个连接的通道, 因此在任意时刻数据传输可以从任意一方发
起, 通讯服务器 20可以不用在即时通讯客户端 30发起请求的前提下, 主动向即时通讯客户端 30发送数据。 The communication between the communication server 20 and the instant messaging client 30 is based on the connection protocol-based encryption protocol established on the TCP protocol or the User Datagram Protocol (UDP). After the connection is established, the communication server 20 and the instant messaging Client 30 will maintain the channel for this connection, so data can be sent from either side at any time. As a result, the communication server 20 can actively send data to the instant messaging client 30 without initiating a request by the instant messaging client 30.
即时通讯客户端 30接收处理后的更新信息, 并对其进行解密和解 析等处理, 得到控制信息和更新的内容信息, 并根据该控制信息和更新 的内容信息进行网页更新操作。 如图 2所示, 在一个实施例中, 即时通 讯客户端 30包括协议处理器 300和网页模块 301。 其中: The instant messaging client 30 receives the processed update information, decrypts and parses it, and obtains control information and updated content information, and performs a web page update operation based on the control information and the updated content information. As shown in FIG. 2, in one embodiment, the instant messaging client 30 includes a protocol processor 300 and a web page module 301. among them:
协议处理器 300接收通讯服务器 20发送的处理后的更新信息, 并 对其进行解密和解析处理, 得到控制信息和更新的内容信息, 将控制信 息和更新的内容信息发送给网页模块 301 ; 网页模块 301接收到控制信 息和更新的内容信息后进行网页更新操作。 在一个实施方式中, 控制信 息包括网页更新方式和需更新的网页的标识号; 更新的内容信息包括更 新的函数名和参数列表等。 参数列表包括参数类型和参数内容等。 The protocol processor 300 receives the processed update information sent by the communication server 20, decrypts and parses the same, obtains the control information and the updated content information, and sends the control information and the updated content information to the webpage module 301; After receiving the control information and the updated content information, the 301 performs a webpage update operation. In one embodiment, the control information includes a web page update mode and an identification number of the web page to be updated; the updated content information includes an updated function name and parameter list, and the like. The parameter list includes parameter types and parameter contents.
在一个实施例中, 在群动态网页中, 网页模块 301可创建多个内嵌 网页, 如多个内嵌网页为内嵌网页 1、 内嵌网页 2 内嵌网页 n。 根据网页模块 301创建的多个内嵌网页的每个内嵌网页的标识号( ID号 ) 和每个内嵌网页所在的群号确定需更新的具体网页。 网页模块 301接收 到控制信息和更新的内容信息后进行网页更新操作。 网页更新操作具体 可通过刷新网页和 /或调用网页的脚本函数(如 JavaScript脚本函数)来 实现。 其中, 刷新网页即重新加载网页的网址; 所述脚本函数符合网页 模块 301和 Web服务器 10共同设定的函数格式。 该函数格式包括操作 类型、 网页标识号和数据内容等。 在一个实施例中, 该函数格式可采用 如表 1所示的格式: In one embodiment, in the group dynamic webpage, the webpage module 301 can create a plurality of embedded webpages, such as a plurality of embedded webpages as an embedded webpage 1, an embedded webpage 2, an embedded webpage n. The specific page to be updated is determined according to the identification number (ID number) of each embedded webpage of the plurality of embedded webpages created by the webpage module 301 and the group number of each embedded webpage. The web page module 301 receives the control information and the updated content information and performs a web page update operation. Web page update operations can be implemented by refreshing web pages and/or scripting functions that call web pages, such as JavaScript script functions. The refreshing webpage reloads the webpage of the webpage; the script function conforms to a function format set by the webpage module 301 and the web server 10. The function format includes the operation type, web page identification number, and data content. In one embodiment, the function format can be in the format shown in Table 1:
表 1 Table 1
操作类型 网页 ID 数据内容 Operation Type Web Page ID Data Content
1: 刷新网页 主 ID号:即内嵌网页标识号 无
子 ID号: 群号 函数名 1: Refresh the main ID number of the webpage: that is, the embedded webpage identification number is not Sub ID number: group number function name
2: JavaScript 函数 2: JavaScript function
参数 type值 调用 Parameter type value call
参数 content值 其中, 当操作类型为 1时, 表示刷新网页, 数据内容为空; 当操作 类型为 2时, 表示调用网页的脚本函数, 数据内容包括函数名、 参数类 型和参数内容。 无论操作类型为 1还是 2, 网页标识号(ID号)均是必 须的, 网页标识号可包括内嵌网页标识号和群号。 Parameter content value where, when the operation type is 1, it means to refresh the webpage, the data content is empty; when the operation type is 2, it means the script function of calling the webpage, the data content includes the function name, the parameter type and the parameter content. Regardless of whether the operation type is 1 or 2, the webpage identification number (ID number) is required, and the webpage identification number may include the embedded webpage identification number and the group number.
另外, 网页模块 301创建的某个内嵌网页接收到调用脚本函数(如 JavaScript脚本函数)更新的操作方式,该脚本函数中可以包含更新的内 容信息, 该内嵌网页根据约定的实现操作, 直接将更新的内容信息显示 出来。 这样无论在格式和内容上都实现了最大的灵活, Web服务器 10 可以随时随地修改更新的内容和更新的格式, 只要控制刷新网页, 新的 脚本函数就会被动态更新,更新的内容也会显示在该内嵌网页中。再者, 网页模块 301也可以直接向 Web服务器 10拉取更新的内容信息, 对网 页进行更新操作。 在一个实施例中, 例如在群会话窗口中, 群动态窗口 的网页显示了该群中很多丰富的动态信息, 在打开群会话窗口时, 当群 社区发生新事件时, 群动态网页会立即更新, 不用重新刷新网页或重新 打开窗口。 In addition, an embedded webpage created by the webpage module 301 receives an operation mode of calling a script function (such as a JavaScript script function), and the script function may include updated content information, and the embedded webpage is directly implemented according to the agreed implementation. Display the updated content information. In this way, the maximum flexibility is achieved in both format and content. Web server 10 can modify the updated content and updated format anytime and anywhere. As long as the control refreshes the webpage, the new script function will be dynamically updated, and the updated content will also be displayed. In the embedded web page. Moreover, the webpage module 301 can also directly pull the updated content information to the web server 10 to perform an update operation on the webpage. In one embodiment, for example, in a group session window, the webpage of the group dynamic window displays a lot of rich dynamic information in the group. When the group session window is opened, when the group community has a new event, the group dynamic webpage is updated immediately. , without having to refresh the page or reopen the window.
如图 3所示, 一种网页数据更新方法, 包括以下步骤: As shown in FIG. 3, a method for updating webpage data includes the following steps:
步骤 S10, 记录更新信息并将更新信息发送出去。 In step S10, the update information is recorded and the update information is sent out.
在一个实施方式中, 通过 Web服务器 10记录更新信息并将更新信 息发送到通讯服务器 20。 在一个实施例中, 如在一个群社区内, Web服 务器 10 用于记录该群社区发生的事件, 并将更新信息传输给通讯服务 器 20。 Web服务器 10将更新信息通过内联网中的 TCP协议的高速通道 传输给通讯服务器 20。
步骤 S20, 接收该更新信息, 对更新信息进行处理, 并将处理后的 更新信息通过面向连接的加密协议发送给即时通讯客户端 30。 In one embodiment, the update information is recorded by the web server 10 and sent to the communication server 20. In one embodiment, as in a group community, the web server 10 is configured to record events that occur in the group community and transmit the update information to the communication server 20. The web server 10 transmits the update information to the communication server 20 through the high speed channel of the TCP protocol in the intranet. Step S20: Receive the update information, process the update information, and send the processed update information to the instant messaging client 30 through the connection-oriented encryption protocol.
通讯服务器 20接收到更新信息后, 对更新信息的原始数据进行打 包和加密等处理, 然后将处理后的更新信息发送给即时通讯客户端 30。 其中,通讯服务器 20和即时通讯客户端 30进行通信是基于 TCP协议或 UDP协议之上制定的面向连接的加密协议的, 连接建立后, 通讯服务器 20和即时通讯客户端 30会保持这个连接的通道, 因此在任意时刻数据 传输可以从任意一方发起, 通讯服务器 20可以不用在即时通讯客户端 30发起请求的前提下, 主动向即时通讯客户端 30发送数据。 After receiving the update information, the communication server 20 performs processing such as packetizing and encrypting the original data of the update information, and then transmits the processed update information to the instant messaging client 30. The communication between the communication server 20 and the instant messaging client 30 is based on a connection-oriented encryption protocol established on the TCP protocol or the UDP protocol. After the connection is established, the communication server 20 and the instant messaging client 30 maintain the connection channel. Therefore, the data transmission can be initiated from any party at any time, and the communication server 20 can actively send data to the instant messaging client 30 without initiating a request by the instant messaging client 30.
步骤 S30, 即时通讯客户端 30接收处理后的更新信息, 并根据处理 后的更新信息得到控制信息和更新的内容信息, ^据控制信息和更新的 内容信息进行网页更新操作。 Step S30, the instant messaging client 30 receives the processed update information, and obtains the control information and the updated content information according to the processed update information, and performs a webpage update operation according to the control information and the updated content information.
在一个实施方式中, 即时通讯客户端 30包括协议处理器 300和网 页模块 301。协议处理器 300接收通讯服务器 20发送的处理后的更新信 息, 并对更新信息进行解密和解析, 得到控制信息和更新的内容信息, 并将控制信息和更新的内容信息发送给网页模块 301 ; 网页模块 301接 收到控制信息和更新的内容信息后进行网页更新操作。 其中, 控制信息 包括网页更新方式和需更新的网页的标识号。 更新的内容信息包括更新 的函数名和参数列表等。 参数列表包括参数类型和参数内容等。 In one embodiment, the instant messaging client 30 includes a protocol processor 300 and a web page module 301. The protocol processor 300 receives the processed update information sent by the communication server 20, decrypts and parses the update information, obtains the control information and the updated content information, and sends the control information and the updated content information to the webpage module 301; The module 301 receives the control information and the updated content information and performs a web page update operation. The control information includes a webpage update method and an identification number of the webpage to be updated. The updated content information includes updated function names, parameter lists, and the like. The parameter list includes parameter types and parameter contents.
在一个实施例中,网页更新操作具体为通过刷新网页和 /或调用网页 的脚本函数来实现。 刷新网页即重新加载网页的网址; 所述脚本函数符 合网页模块 301和 Web服务器 10共同设定的函数格式。 该函数格式包 括操作类型、 网页标识号和数据内容等。 在一个实施例中, 函数格式可 采用如表 1所述的格式。 网页模块 301创建的某个内嵌网页接收到调用 脚本函数(如 JavaScript脚本函数) 更新的操作方式, 该脚本函数中包
含有更新的内容信息, 该内嵌网页根据约定的实现操作, 直接将更新的 内容信息显示出来。 In one embodiment, the web page update operation is specifically implemented by a script function that refreshes the web page and/or invokes the web page. Refreshing the webpage reloads the webpage of the webpage; the script function conforms to a function format set by the webpage module 301 and the web server 10. The function format includes the operation type, web page identification number, and data content. In one embodiment, the function format can take the format described in Table 1. An embedded webpage created by the webpage module 301 receives an update operation mode of a calling script function (such as a JavaScript script function), and the script function package Containing updated content information, the embedded web page directly displays the updated content information according to the agreed implementation operation.
在另一个实施例中, 上述网页数据更新方法还包括通过即时通讯客 户端 30 直接拉取更新的内容信息, 并进行网页更新操作, 即网页模块 301也可以直接向 Web服务器 10拉取更新的内容信息。 在一个实施例 中, 群会话窗口中, 群动态窗口的网页显示了该群中很多丰富的动态信 息, 在打开群会话窗口时, 当群社区发生新事件时, 群动态网页会立即 更新, 不用重新刷新网页或重新打开窗口。 In another embodiment, the method for updating the webpage data further includes directly extracting the updated content information by the instant messaging client 30, and performing a webpage update operation, that is, the webpage module 301 can also directly pull the updated content to the web server 10. information. In an embodiment, in the group session window, the webpage of the group dynamic window displays a lot of rich dynamic information in the group. When the group session window is opened, when a new event occurs in the group community, the group dynamic webpage is updated immediately, without Refresh the page or reopen the window.
上述网页数据更新系统及方法中, 将更新信息通过通讯服务器处理 后通过面向连接的加密协议发送给即时通讯客户端, 即时通讯客户端的 协议处理器根据更新信息得到控制信息和数据信息, 并根据控制信息和 数据信息进行网页更新操作, 不用定时发送请求信息,减轻了 Web服务 器和网络带宽的压力, 即时通讯客户端的网页更新响应也更快速, 操作 筒单, 不用复杂的网页脚本, 性能高。 In the above webpage data updating system and method, the update information is sent to the instant messaging client through the connection-oriented encryption protocol after being processed by the communication server, and the protocol processor of the instant messaging client obtains the control information and the data information according to the update information, and according to the control The information and data information is updated by the webpage, and the request information is not sent periodically, which reduces the pressure on the web server and the network bandwidth. The instant messaging client's webpage update response is also faster, the operation is simple, and the complicated webpage script is not required, and the performance is high.
另外, 采用直接从 Web服务器拉取更新的内容信息的方式, 能够使 数据更新更加快速, 达到更好的实时更新的效果。 In addition, the method of pulling updated content information directly from the web server can make the data update faster and achieve better real-time update effect.
以上所述仅为本发明的较佳实施例而已, 并不用以限制本发明, 凡 在本发明的精神和原则之内, 所做的任何修改、 等同替换、 改进等, 均 应包含在本发明的保护范围之内。
The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention. Any modifications, equivalents, improvements, etc., which are made within the spirit and principles of the present invention, should be included in the present invention. Within the scope of protection.