Information pushing method and system based on long connection
By adopting long connection technology in the information push system, it ensures that information push is carried out under long connection conditions, solving the problem of untimely and low success rate of information push caused by short connections, and improving the success rate and users of the web page calling APP Experience.
Patent Information
- Application Number
- CN202310675386.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-07
- Publication Date
- 2024-12-10
AI Technical Summary
In the prior art, when web pages and APPs push information through short connections, the information is not pushed in time, the success rate of calling by web pages is reduced, and the user complaint rate is high.
Using a long connection-based information push method, by establishing a communication connection with the client of the information push system, obtaining user information and connection channel information, determining whether the client is a long connection, and sending push data packets under the long connection conditions to ensure information Timeliness of push.
It improves the success rate of calling on the web page APP, reduces the user's complaint rate, and makes information push more timely and reliable.
Smart Images

Figure CN119109810A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information push, and in particular to an information push method and system based on long connection. Background Art
[0002] With the development of mobile Internet technology, information push technology has become a common and important technology. For example, information push between web pages and APPs (Applications) can push phone numbers in web pages to APPs as information, and then make calls through APPs to transmit call records back to web pages in real time.
[0003] Currently, web pages and APPs push information through short connections. In the process of using short connections to push information, a connection will be established between the web page and the APP only when information needs to be pushed. The connection will be disconnected after the information push is completed, which will lead to untimely information push and a lower success rate for the web page to invoke the APP to make a call, resulting in a high rate of user complaints. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide an information push method and system based on long connection, which makes the information push more timely by using long connection, improves the success rate of web page to call APP, and reduces the user complaint rate.
[0005] In the first aspect, an embodiment of the present invention provides an information push method based on a long connection, which is applied to a server of an information push system based on a long connection, including: establishing a communication connection with a client of the information push system, and obtaining user information and connection channel information based on the communication connection; determining whether it is a long connection with the client based on the user information and the connection channel information; if it is a long connection with the client, sending a push data packet to the client so that the client obtains the push information in the push data packet; wherein the push data packet is a response to a heartbeat packet sent by the client.
[0006] In a preferred embodiment of the present invention, the above-mentioned determining whether it is a long connection with the client based on the user information and the connection channel information includes: determining whether the user information and the connection channel information correspond based on a preset corresponding relationship; if the user information and the connection channel information correspond, it is a long connection with the client.
[0007] In a preferred embodiment of the present invention, after determining whether the connection with the client is a long connection based on the user information and the connection channel information, the method further includes: if the connection with the client is not a long connection, re-establishing the communication connection with the client.
[0008] In a preferred embodiment of the present invention, the method further comprises: if an error occurs in the communication connection with the client, an error message is sent to a web page of the information push system.
[0009] In a preferred embodiment of the present invention, after sending the push data packet to the client, the method further includes: sending the push result to the web page of the information push system; wherein the push result includes receiving the response information sent by the client and the client not responding.
[0010] In the second aspect, an embodiment of the present invention provides an information push method based on a long connection, which is applied to a client of an information push system based on a long connection, including: in response to a successful user login, establishing a communication connection with a server of the information push system; sending a heartbeat packet to the server based on the communication connection; in response to receiving a push data packet sent by the server, determining that the connection with the client is a long connection; wherein the push data packet is a response to the heartbeat packet; and obtaining push information in the push data packet.
[0011] In a preferred embodiment of the present invention, the above-mentioned sending of the heartbeat packet to the server based on the communication connection includes: sending the heartbeat packet to the server at a fixed time based on the communication connection; if the push data packet is not received within a preset number of times, re-establishing the communication connection with the server until the push data packet is received.
[0012] In a preferred embodiment of the present invention, the above-mentioned re-establishing the communication connection with the server until a push data packet is received includes: after re-establishing the communication connection with the server, if no push data packet is received, waiting for a preset time and then re-establishing the communication connection with the server until a push data packet is received.
[0013] In a third aspect, an embodiment of the present invention further provides an information push system based on a long connection, comprising: a server and a client, the server being used to execute the above-mentioned information push method based on a long connection, and the client being used to execute the above-mentioned information push method based on a long connection.
[0014] In a preferred embodiment of the present invention, the system also includes a web page end, which is used to send push data packets to the server end, receive error information returned by the server end, and receive push results returned by the server end.
[0015] The embodiments of the present invention bring the following beneficial effects:
[0016] The embodiment of the present invention provides a method and system for information push based on long connection, which establishes a communication connection with the client of the information push system, obtains user information and connection channel information based on the communication connection, and then determines whether the connection with the client is long based on the user information and connection channel information. Under the condition of long connection with the client, a push data packet is sent to the client as a response to the heartbeat packet sent by the client, so that the client obtains the push information in the push data packet. It ensures that the push data packet is pushed under the condition of long connection, makes information push more timely, improves the success rate of web page waking up APP to make a call, and reduces the user complaint rate.
[0017] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present disclosure.
[0018] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 A flowchart of a method for pushing information based on a long connection applied to a server provided in an embodiment of the present invention;
[0021] Figure 2 A flowchart of another method for pushing information based on a long connection applied to a server provided in an embodiment of the present invention;
[0022] Figure 3 A flowchart of a method for pushing information based on a persistent connection applied to a client provided by an embodiment of the present invention;
[0023] Figure 4 A flowchart of another method for pushing information based on a persistent connection applied to a client provided in an embodiment of the present invention;
[0024] Figure 5 An internal interaction diagram of an information push system based on a persistent connection provided by an embodiment of the present invention;
[0025] Figure 6A schematic diagram of the structure of an information push device based on a long connection applied to a server provided in an embodiment of the present invention;
[0026] Figure 7 A schematic diagram of the structure of a persistent connection-based information push device applied to a client provided by an embodiment of the present invention;
[0027] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0029] With the development of mobile Internet technology, information push technology has become a common and important technology. For example, information push between web pages and APPs can push the phone number in the web page to the APP as information, and then make a call through the APP to transmit the call record back to the web page in real time.
[0030] At present, web pages and APPs push information through short connections and both are processed asynchronously. In the process of using short connections to push information, a connection will be established between the web page and the APP only when information needs to be pushed. The connection will be disconnected after the information push is completed, so information push will not be timely, and the success rate of the web page invoking the APP to make a call will be reduced, resulting in a high user complaint rate. When pushing messages, you can also directly use third-party personal push software to push messages, but relying on third-party personal push software for information push, the success rate of the call will be completely dependent on the stability of the third-party personal push software, and the success rate of the call cannot be optimized independently.
[0031] Based on this, the embodiment of the present invention provides a method and device for information push based on long connection, which can establish a communication connection with the client of the information push system, obtain user information and connection channel information based on the communication connection, and then determine whether it is a long connection with the client based on the user information and connection channel information. Under the condition of a long connection with the client, the push data packet is sent to the client as a response to the heartbeat packet sent by the client, so that the client can obtain the push information in the push data packet. It ensures that the push data packet is pushed under the condition of a long connection, making the information push more timely, improving the success rate of the web page to call the APP, and reducing the user complaint rate.
[0032] To facilitate understanding of this embodiment, a method for pushing information based on a long connection disclosed in an embodiment of the present invention is first introduced in detail.
[0033] Example 1
[0034] An embodiment of the present invention provides an information push method based on a persistent connection, which is applied to a server of an information push system based on a persistent connection. Figure 1 The present invention provides a flowchart of a method for pushing information based on a long connection applied to a server. Figure 1 As shown, the information push method based on long connection may include the following steps:
[0035] Step S101: establish a communication connection with a client of the information push system, and obtain user information and connection channel information based on the communication connection.
[0036] Among them, after the user successfully logs in to the client, a communication connection will be established between the server and the client. The established communication connection can be a WebSocket connection. WebSocket is a protocol for full-duplex communication on a single TCP (Transmission Control Protocol) connection, which makes data exchange between the client and the server easier and allows the server to actively push data to the client.
[0037] Among them, user information may include a user ID (Identity document), and connection channel information may include a WebSocket address and a WebSocket port, etc. The user information corresponds to the connection channel information. The user information corresponding to one user corresponds to only one connection channel information. After a communication connection is established with the client, the user information and connection channel information can be obtained and saved in a local cache container accordingly, so that the user information and connection channel information in the local cache container can be compared with the currently obtained user information and connection channel information.
[0038] Step S102: Determine whether the connection with the client is a long connection based on the user information and the connection channel information.
[0039] There is a corresponding relationship between user information and connection channel information. When the user information and connection channel information correspond, it can be considered that the connection with the client is a long connection. The long connection can ensure the persistent connection of the communication connection with the client.
[0040] Step S103: If the connection with the client is long, the push data packet is sent to the client.
[0041] The push data packet is a response to the heartbeat packet sent by the client, and the push data packet may include push information such as phone number, user type, user ID, etc.
[0042] After sending the push data packet to the client, the client can obtain the push information in the push data packet. After the client obtains the push information in the push data, the response information will be returned to the client within a certain period of time. If the response information is not received within a certain period of time, it is considered that the client has not responded. The server will send the client's response as a push result to the web page of the information push system. Among them, the push result includes the response information sent by the client and the client's non-response. In the case of the client's non-response, the server can actively disconnect the communication connection with the client.
[0043] Among them, each push information corresponds to its own unique information identifier, and the response information returned by the client to the push message also carries the information identifier corresponding to the push information. When the client processes the push request, the push information under the same information identifier is only processed once.
[0044] The information push method based on long connection provided by the embodiment of the present invention establishes a communication connection with the client of the information push system, obtains user information and connection channel information based on the communication connection, and then determines whether it is a long connection with the client based on the user information and connection channel information. Under the condition of a long connection with the client, a push data packet is sent to the client as a response to a heartbeat packet sent by the client, so that the client obtains the push information in the push data packet. It ensures that the push data packet is pushed under the condition of a long connection, making the information push more timely, improving the success rate of the web page to call the APP, and reducing the user complaint rate.
[0045] Example 2
[0046] The embodiment of the present invention also provides another information push method based on long connection, which is applied to the server. The method is implemented on the basis of the method in the above embodiment. The method focuses on describing the specific implementation method of determining whether it is a long connection with the client based on user information and connection channel information.
[0047] Figure 2 A flowchart of another method for pushing information based on a long connection applied to a server provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the information push method based on long connection may include the following steps:
[0048] Step S201: determining whether user information and connection channel information correspond to each other based on a preset corresponding relationship.
[0049] After the user successfully logs in to the client, the user information and connection channel information obtained from the communication connection established between the server and the client will be stored in the local cache container accordingly. The preset corresponding relationship can be the corresponding relationship between the user information and the connection channel information stored in the local cache container. By comparing the preset corresponding relationship with the user information and the connection channel information, it can be determined whether the user information and the connection channel information correspond.
[0050] Step S202: If the user information and the connection channel information correspond, then the connection with the client is a long connection.
[0051] The preset corresponding relationship is compared with the user information and the connection channel information. If the user information and the connection channel information are in the preset corresponding relationship, the client is a long connection.
[0052] The preset correspondence is compared with the user information and the connection channel information. If the user information and the connection channel information are not in the preset correspondence, the client is not a long connection, and the communication connection with the client needs to be re-established.
[0053] In the process of establishing a communication connection with the client, there is a possibility that an error occurs in the communication connection with the client. When an error occurs in the communication connection with the client, an error message will be sent to the web page of the information push system.
[0054] Among them, errors that occur in the communication connection with the client may include client exit, communication connection process stop, client disconnection, client offline, etc., and the error information is a corresponding description of the errors that occur in the communication connection with the client.
[0055] The information push method based on long connection provided by the embodiment of the present invention determines whether the user information and the connection channel information correspond through a preset corresponding relationship, and then determines whether it is a long connection with the client through whether the user information and the connection channel information correspond, thereby ensuring that information is pushed on the basis of the long connection, ensuring a persistent connection between the communication connection with the client, avoiding the need to re-establish the communication connection with the client when pushing information, making information push more timely, and avoiding the disconnection of the phone when the web page invokes the APP to make a call and the interruption of the call record return, thereby improving the success rate of the web page invoking the APP to make a call and reducing the user complaint rate.
[0056] Example 3
[0057] The embodiment of the present invention provides an information push method based on a persistent connection, which is applied to a client of an information push system based on a persistent connection. Figure 3 The present invention provides a flowchart of a method for pushing information based on a persistent connection applied to a client. Figure 3As shown, the information push method based on long connection may include the following steps:
[0058] Step S301, in response to a successful user login, establishing a communication connection with a server of the information push system.
[0059] After the user logs in successfully, a communication connection will be established between the server and the client. The established communication connection can be a WebSocket connection.
[0060] Step S302: Send the heartbeat packet to the server based on the communication connection.
[0061] The heartbeat packet may include user information, user type, enterprise information, etc. By sending a heartbeat packet to the server, the connection with the server can be maintained.
[0062] Step S303, responding to receiving the push data packet sent by the server, and determining that the connection with the client is a long connection.
[0063] The push data packet is a response to the heartbeat packet sent to the server. By receiving the push data packet sent by the server, it can be determined that the communication connection between the server and the client has not been disconnected and it is a long connection with the client.
[0064] Step S304: acquiring push information in the push data packet.
[0065] After receiving the push data packet sent by the server, the push data packet can be decompressed to obtain the push information therein, which may include a telephone number, a user type, a user ID, and the like.
[0066] The information push method based on long connection provided by the embodiment of the present invention establishes a communication connection with the server, sends a heartbeat packet to the server, then receives a push data packet sent by the server, obtains the push information in the push data packet, and completes the information push under the long connection, so that the information push is more timely, and also avoids the disconnection of the phone when the web page calls the APP to make a call and the interruption of the call record return, thereby improving the success rate of the web page calling the APP to make a call and reducing the user complaint rate.
[0067] Example 4
[0068] An embodiment of the present invention also provides another information push method based on a long connection, which is applied to a client. The method is implemented on the basis of the method in the above embodiment. The method focuses on describing a specific implementation method of sending a heartbeat packet to a server based on a communication connection.
[0069] Figure 4 A flowchart of another method for pushing information based on a long connection applied to a client provided by an embodiment of the present invention is shown in FIG. Figure 4As shown, the information push method based on long connection may include the following steps:
[0070] Step S401, sending a heartbeat packet to a server based on the communication connection timing.
[0071] By sending heartbeat packets to the server at regular intervals, the detection frequency of the connection status between the client and the server is increased, the communication connection between the client and the server is further maintained, and the duration of disconnection of the communication connection between the client and the server is reduced.
[0072] Step S402: If the push data packet is not received within a preset number of times, re-establish the communication connection with the server until the push data packet is received.
[0073] The preset number of times may be two. If no push data packet is received for two consecutive times, a connection with the server will be re-established.
[0074] Specifically, after the communication connection with the server is re-established, if the push data packet is not received, the communication connection with the server is re-established after waiting for a preset time until the push data packet is received.
[0075] Among them, after re-establishing the communication connection with the server, if the push data packet is still not received, the reconnection is considered to have failed. At this time, the reconnection will be initiated again within a preset time. If the reconnection is still not successful within a certain number of times, it will wait for a certain period of time before initiating the reconnection again until the push data packet is received.
[0076] The preset time may be 10 seconds, the certain number of times may be twice, and the certain time may be n×10, where n is the number of reconnections.
[0077] As an implementation method, when a change in the network environment is detected, a communication connection with the server is actively established. The change in the network environment may be a network disconnection, a network change, or a client offline.
[0078] The information push method based on long connection provided by the embodiment of the present invention detects the connection status between the client and the server by periodically sending heartbeat packets to the server, thereby further maintaining the communication connection between the client and the server and reducing the duration of disconnection of the communication connection between the client and the server.
[0079] Example 5
[0080] The embodiment of the present invention also provides an information push system based on a long connection, such as Figure 5 The figure shows an internal interaction diagram of an information push system based on a long connection provided by an embodiment of the present invention.
[0081] The information push system based on long connection can include a server and a client. The server is used to execute Figure 1 and Figure 2 The information push method based on long connection is mentioned in the client. Figure 3 and Figure 4 The information push method based on long connection is mentioned.
[0082] The information push system based on long connection may also include a web page end, which is used to send push data packets to the server end, receive error information returned by the server end, and receive push results returned by the server end.
[0083] In actual applications, users can select the customer they want to contact on the web page, obtain the customer's phone number on the web page, and then send it to the server. The server will package the customer's phone number as a push information package and forward it to the APP in the client. After receiving the push information package, the APP can parse the phone number in it and dial the phone number. After the call is connected, the call content can be recorded. While recording, the call content can be sent to the server in real time, and forwarded to the web page by the server. The web page will save the call content. The web page can also organize and classify all received call content according to customer type, call quality, call duration, etc., and can also count the success rate of the web page to call the APP.
[0084] Example 6
[0085] Corresponding to the above method embodiment, an embodiment of the present invention provides an information push device based on a persistent connection, which is applied to a server of an information push system based on a persistent connection. Figure 6 The present invention provides a schematic diagram of a structure of a persistent connection-based information push device applied to a server. Figure 6 As shown, the information push device based on long connection includes:
[0086] The information acquisition module 601 is used to establish a communication connection with a client of the information push system, and acquire user information and connection channel information based on the communication connection.
[0087] The long connection determination module 602 is used to determine whether the connection with the client is a long connection based on the user information and the connection channel information.
[0088] The push data packet sending module 603 is used to send a push data packet to the client if it is a long connection with the client, so that the client can obtain the push information in the push data packet; wherein the push data packet is a response to the heartbeat packet sent by the client.
[0089] The information push device based on long connection provided by the embodiment of the present invention establishes a communication connection with the client of the information push system, obtains user information and connection channel information based on the communication connection, and then determines whether it is a long connection with the client based on the user information and connection channel information. Under the condition of a long connection with the client, a push data packet is sent to the client as a response to the heartbeat packet sent by the client, so that the client obtains the push information in the push data packet. It ensures that the push data packet is pushed under the condition of a long connection, making the information push more timely, improving the success rate of the web page to call the APP, and reducing the user complaint rate.
[0090] In some embodiments, the long connection determination module is further used to determine whether the user information and the connection channel information correspond based on a preset correspondence relationship; if the user information and the connection channel information correspond, it is a long connection with the client.
[0091] In some embodiments, the long connection determination module is further used to re-establish the communication connection with the client if the connection with the client is not a long connection.
[0092] In some embodiments, the long connection determination module is also used to send an error message to the web page of the information push system if an error occurs in the communication connection with the client.
[0093] In some embodiments, the push data packet sending module is also used to send the push result to the web page of the information push system; wherein the push result includes the response information sent by the client and the client's non-response.
[0094] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0095] Example 7
[0096] Corresponding to the above method embodiment, an embodiment of the present invention provides an information push device based on a persistent connection, which is applied to a client of an information push system based on a persistent connection. Figure 7 The present invention provides a schematic diagram of a structure of a persistent connection-based information push device applied to a client. Figure 7 As shown, the information push device based on long connection includes:
[0097] The communication connection establishing module 701 is used to establish a communication connection with the server of the information push system in response to a successful login of the user.
[0098] The heartbeat packet sending module 702 is used to send the heartbeat packet to the server based on the communication connection.
[0099] The push data packet response module 703 is used to respond to the push data packet sent by the receiving server and determine that the connection with the client is a long connection.
[0100] Among them, the push data packet is a response to the heartbeat packet.
[0101] The push information acquisition module 704 is used to push the push information in the data packet.
[0102] The information push device based on long connection provided by the embodiment of the present invention establishes a communication connection with the server, sends a heartbeat packet to the server, then receives a push data packet sent by the server, obtains the push information in the push data packet, and completes the information push under the long connection, so that the information push is more timely, and also avoids the disconnection of the phone when the web page calls the APP and the interruption of the call record return, thereby improving the success rate of the web page calling the APP to make a call and reducing the user complaint rate.
[0103] In some embodiments, the heartbeat packet sending module is also used to send the heartbeat packet to the server based on the communication connection timing; if the push data packet is not received within a preset number of times, the communication connection with the server is re-established until the push data packet is received.
[0104] In some embodiments, the heartbeat packet sending module is also used to wait for a preset time and then re-establish the communication connection with the server if the push data packet is not received after the communication connection with the server is re-established, until the push data packet is received.
[0105] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0106] Example 8
[0107] The embodiment of the present invention also provides an electronic device for executing the above-mentioned information push method based on long connection. Figure 8 A structural schematic diagram of an electronic device is shown, which includes a memory 800 and a processor 801, wherein the memory 800 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 801 to implement the above-mentioned information push method based on long connection.
[0108] Further, Figure 8 The electronic device shown further includes a bus 802 and a communication interface 803 , and the processor 801 , the communication interface 803 and the memory 800 are connected via the bus 802 .
[0109] The memory 800 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 803 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 802 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0110] The processor 801 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 801. The above processor 801 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 800, and the processor 801 reads the information in the memory 800 and completes the steps of the method of the above embodiment in combination with its hardware.
[0111] An embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned information push method based on long connection. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0112] The computer program product for performing a method for pushing information based on a long connection provided in an embodiment of the present invention includes a computer-readable storage medium storing a non-volatile program code executable by a processor. The instructions included in the program code can be used to execute the method described in the previous method embodiment. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0113] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0114] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0115] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0116] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0117] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0118] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for pushing information based on a long connection, characterized in that: The server side used in the information push system based on long connection includes: Establishing a communication connection with a client of the information push system, and acquiring user information and connection channel information based on the communication connection; Determine whether the connection with the client is a long connection based on the user information and the connection channel information; If the connection with the client is long, a push data packet is sent to the client so that the client obtains the push information in the push data packet; wherein the push data packet is a response to the heartbeat packet sent by the client.
2. The method according to claim 1, characterized in that The determining whether the connection with the client is a long connection based on the user information and the connection channel information includes: Determining whether the user information and the connection channel information correspond to each other based on a preset corresponding relationship; If the user information and the connection channel information correspond, then the connection with the client is a long connection.
3. The method according to claim 1, characterized in that After determining whether the connection with the client is a long connection based on the user information and the connection channel information, the method further includes: If the connection with the client is not a long connection, re-establish the communication connection with the client.
4. The method according to claim 1, characterized in that: Also includes: If an error occurs in the communication connection with the client, an error message is sent to the web page of the information push system.
5. The method according to claim 1, characterized in that After sending the push data packet to the client, the method further includes: The push result is sent to the web page of the information push system; wherein the push result includes receiving the response information sent by the client and the client not responding.
6. A method for pushing information based on a long connection, characterized in that: Applicable to the client of the information push system based on long connection, including: In response to a successful login of the user, establishing a communication connection with a server of the information push system; Sending a heartbeat packet to the server based on the communication connection; In response to receiving a push data packet sent by the server, determining that the connection with the client is a long connection; wherein the push data packet is a response to the heartbeat packet; The push information in the push data packet is obtained.
7. The method according to claim 6, characterized in that The sending of the heartbeat packet to the server based on the communication connection includes: Sending the heartbeat packet to the server based on the communication connection timing; If the push data packet is not received within a preset number of times, a communication connection with the server is re-established until the push data packet is received.
8. The method according to claim 7, characterized in that The re-establishing of the communication connection with the server until the push data packet is received includes: After re-establishing the communication connection with the server, if the push data packet is not received, then wait for a preset time and then re-establish the communication connection with the server until the push data packet is received.
9. An information push system based on long connection, characterized in that: It comprises a server and a client, wherein the server is used to execute the method described in any one of claims 1 to 5, and the client is used to execute the method described in any one of claims 6 to 8.
10. The information push system based on long connection according to claim 9, characterized in that: It also includes the web version; The web page is used to send a push data packet to the server, receive error information returned by the server, and receive a push result returned by the server.
