CN114520827B - Message receiving method, pushing method, system and medium - Google Patents
Message receiving method, pushing method, system and medium Download PDFInfo
- Publication number
- CN114520827B CN114520827B CN202210143554.1A CN202210143554A CN114520827B CN 114520827 B CN114520827 B CN 114520827B CN 202210143554 A CN202210143554 A CN 202210143554A CN 114520827 B CN114520827 B CN 114520827B
- Authority
- CN
- China
- Prior art keywords
- subscription
- request information
- server
- user
- user side
- 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
- 238000000034 method Methods 0.000 title claims abstract description 92
- 230000008859 change Effects 0.000 claims abstract description 110
- 230000004913 activation Effects 0.000 claims abstract description 57
- 238000004891 communication Methods 0.000 claims description 19
- 230000004044 response Effects 0.000 claims description 10
- 230000000694 effects Effects 0.000 abstract description 10
- 230000008569 process Effects 0.000 description 26
- 238000013461 design Methods 0.000 description 24
- 238000012545 processing Methods 0.000 description 20
- 238000004140 cleaning Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 5
- 230000005540 biological transmission Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000002452 interceptive effect Effects 0.000 description 3
- 230000006399 behavior Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 2
- 230000003213 activating effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention discloses a message receiving method, a pushing method, a system and a medium, comprising the following steps: based on the content requirement of a first page currently displayed by a user side, first subscription request information (comprising a first subscription topic and at least one first parameter module corresponding to the first subscription topic) is sent to a server side connected with the user side through an MQTT protocol; after determining that the server side responds to the first subscription request information, calling a first HTTPS interface to send first activation request information to the server side; the server receives the first state change parameter information pushed after responding to the first activation request information, and displays the first state change parameter information through the first page, so that the effect that the server does not need to continuously push all state change information related to the first subscription theme to the user side, and the user side only needs to receive the required first state change parameter information can be achieved, and the effects of reducing flow consumption of the server side and the user side and reducing the cost of message pushing are achieved.
Description
Technical Field
The present invention relates to the field of network communication information pushing technologies, and in particular, to a message receiving method, a pushing method, a system, and a medium.
Background
With the development of science and technology, the server may perform interactive communication with a plurality of device sides and a plurality of user sides, for example, the server may obtain state parameters of the plurality of device sides, and then push the state parameters of the plurality of device sides to one or more user sides. For example, the server is connected with the client through a message queue telemetry transport (Message Queuing Telemetry Transport, MQTT) protocol, and pushes the state parameters subscribed by the client to the client.
Currently, in the process that a server pushes state parameters subscribed by a user to the user, the server needs to send the state parameters of a device to the user in time for display. However, the parameter information of the device side is numerous, the state change is frequent, and the server side obtains a large amount of high-frequency data. If the server directly pushes the acquired data to the user side, the problems of high pushing frequency and large pushing data volume exist, so that the server and the user side need to consume larger flow, and the message pushing cost is higher.
Disclosure of Invention
Based on the above, the invention aims to provide a message receiving method, a pushing method, a system and a medium, which are used for reducing the pushing frequency and the pushing data amount in the process of pushing information from a server to a user, so as to achieve the effects of reducing the flow consumption of the server and the user and reducing the cost of message pushing.
In a first aspect, an embodiment of the present invention provides a message receiving method, including:
Based on the content requirement of a first page currently displayed by a user side, sending first subscription request information to a server side connected with the user side through an MQTT protocol, wherein the first subscription request information comprises a first subscription topic required by the user side and at least one first parameter module corresponding to the first subscription topic;
After the server responds to the first subscription request information, first activation request information sent to the server by calling a first HTTPS interface is determined, wherein the first activation request information is used for indicating to push first state change parameter information related to the at least one first parameter module to the user, and the first state change parameter is acquired from at least one equipment end by the server based on the first subscription theme;
and receiving the first state change parameter information which is pushed by the server side after responding to the first activation request information, and displaying the first state change parameter information through the first page.
In one possible design, after the first state change parameter information is displayed by the first page, the method further includes:
If the following preset operation is monitored, sending subscription cancellation request information to the server, wherein the subscription cancellation request information is used for indicating the user side to cancel subscription to the first subscription theme so that the server stops pushing the first state change parameter information to the user side;
The preset operation is one of the following operations:
the user side executes background operation;
The user side jumps to other pages from the first page;
Installing the user equipment of the user terminal to enter a screen-extinguishing or screen-locking state;
and switching the first page to web pages of other clients.
In one possible design, the method further comprises:
If the user side is monitored to return to the foreground operation from the background operation, determining whether the second page currently displayed by the user side needs to subscribe to the message or not;
If the second page is determined to need to subscribe to the message, second subscription request information is sent to the server based on the content requirement of the second page, wherein the second subscription request information comprises a second subscription topic required by the user side and at least one second parameter module corresponding to the second subscription topic;
After determining that the server responds to the second subscription request information, invoking a second HTTPS interface to send second activation request information to the server, wherein the second activation request information is used for indicating to push second state change parameter information related to the at least one second parameter module to the user, and the second state change parameter is acquired from the at least one equipment end by the server based on the second subscription theme;
and receiving the second state change parameter information pushed by the server in response to the second activation request information, and displaying the second state change parameter information through the second page.
In one possible design, the method further comprises:
If the user side is monitored to return to the first page from the other pages, returning to execute the content requirement based on the first page currently displayed by the user side, and sending first subscription request information to a server side connected with the user side through an MQTT protocol.
In one possible design, the method further comprises:
And if the user equipment is monitored to recover to the screen-on display state from the screen-off state or the screen-locking state to display the first page, returning to execute the content requirement based on the first page currently displayed by the user side, and sending first subscription request information to a server side connected with the user side through an MQTT protocol.
In one possible design, the method further comprises:
if the user is monitored to switch back to the first page from the web pages of the other user terminals, the content requirement based on the first page currently displayed by the user terminal is returned to be executed, and first subscription request information is sent to a server terminal connected with the user terminal through an MQTT protocol.
In a second aspect, an embodiment of the present invention further provides a message pushing method, including:
receiving subscription request information sent by a user terminal connected through an MQTT protocol based on the content requirement of a first page which is currently displayed, wherein the subscription request information comprises a subscription topic required by the user terminal and at least one parameter module corresponding to the subscription topic;
Responding to the subscription request information, and acquiring state change parameter information related to at least one parameter module from at least one equipment terminal based on the subscription theme;
receiving activation request information sent by the user side through invoking an HTTPS interface, wherein the activation request information is used for indicating to push the state change parameter information to the user side;
And responding to the activation request information, pushing the state change parameter information to the user side so that the user side displays the state change parameter information through the first page.
In one possible design, after pushing the state change parameter to the client in response to the activation request information, the method further includes:
receiving subscription cancellation request information sent by the user side, wherein the subscription cancellation request information is used for indicating the user side to cancel subscribing the subscription theme;
and responding to the subscription cancellation request information, and stopping pushing the state change parameter information to the user terminal.
In a third aspect, the present invention further provides a network communication system, including: the system comprises a user terminal and a server terminal, wherein the user terminal and the server terminal are connected through an MQTT protocol; wherein,
The user side is configured to implement a method related to any one of the possible designs in the first aspect;
The server is configured to implement a method related to any one of the possible designs of the second aspect.
In a fourth aspect, an embodiment of the present invention provides a client, including:
The processing unit is used for sending first subscription request information to a server connected with the user through an MQTT protocol based on the content requirement of a first page currently displayed by the user, wherein the first subscription request information comprises a first subscription topic required by the user and at least one first parameter module corresponding to the first subscription topic;
The processing unit is further configured to determine, after the server responds to the first subscription request information, first activation request information sent to the server by calling a first HTTPS interface, where the first activation request information is used to instruct pushing, to the user, first state change parameter information related to the at least one first parameter module, where the first state change parameter is acquired by the server from at least one device based on the first subscription theme;
The display unit is used for receiving the first state change parameter information pushed by the server in response to the first activation request information and displaying the first state change parameter information through the first page.
In one possible design, the processing unit is further configured to:
If the following preset operation is monitored, sending subscription cancellation request information to the server, wherein the subscription cancellation request information is used for indicating the user side to cancel subscription to the first subscription theme so that the server stops pushing the first state change parameter information to the user side;
The preset operation is one of the following operations:
the user side executes background operation;
The user side jumps to other pages from the first page;
Installing the user equipment of the user terminal to enter a screen-extinguishing or screen-locking state;
and switching the first page to web pages of other clients.
In one possible design, the processing unit is further configured to:
If the user side is monitored to return to the foreground operation from the background operation, determining whether the second page currently displayed by the user side needs to subscribe to the message or not;
If the second page is determined to need to subscribe to the message, second subscription request information is sent to the server based on the content requirement of the second page, wherein the second subscription request information comprises a second subscription topic required by the user side and at least one second parameter module corresponding to the second subscription topic;
After determining that the server responds to the second subscription request information, invoking a second HTTPS interface to send second activation request information to the server, wherein the second activation request information is used for indicating to push second state change parameter information related to the at least one second parameter module to the user, and the second state change parameter is acquired from the at least one equipment end by the server based on the second subscription theme;
the display unit is further configured to: and receiving the second state change parameter information pushed by the server in response to the second activation request information, and displaying the second state change parameter information through the second page.
In one possible design, the processing unit is further configured to:
If the user side is monitored to return to the first page from the other pages, returning to execute the content requirement based on the first page currently displayed by the user side, and sending first subscription request information to a server side connected with the user side through an MQTT protocol.
In one possible design, the processing unit is further configured to:
And if the user equipment is monitored to recover to the screen-on display state from the screen-off state or the screen-locking state to display the first page, returning to execute the content requirement based on the first page currently displayed by the user side, and sending first subscription request information to a server side connected with the user side through an MQTT protocol.
In one possible design, the processing unit is further configured to:
if the user is monitored to switch back to the first page from the web pages of the other user terminals, the content requirement based on the first page currently displayed by the user terminal is returned to be executed, and first subscription request information is sent to a server terminal connected with the user terminal through an MQTT protocol.
In a fifth aspect, an embodiment of the present invention further provides a user equipment, where the user equipment includes: at least one memory and at least one processor;
The at least one memory is used for storing one or more programs;
The method of any one of the possible designs described above is implemented when the one or more programs are executed by the at least one processor.
In a sixth aspect, an embodiment of the present invention further provides a server, including:
The receiving unit is used for receiving subscription request information sent by a user terminal connected through an MQTT protocol based on the content requirement of a first page which is currently displayed, wherein the subscription request information comprises a subscription topic required by the user terminal and at least one parameter module corresponding to the subscription topic;
the processing unit is used for responding to the subscription request information and acquiring state change parameter information related to the at least one parameter module from at least one equipment terminal based on the subscription theme;
The receiving unit is further configured to receive activation request information sent by the user side through invoking an HTTPS interface, where the activation request information is used to instruct pushing the state change parameter information to the user side;
the processing unit is further configured to push the state change parameter information to the user side in response to the activation request information, so that the user side displays the state change parameter information through the first page.
In one possible design, the receiving unit is further configured to: receiving subscription cancellation request information sent by the user side, wherein the subscription cancellation request information is used for indicating the user side to cancel subscribing the subscription theme;
The processing unit is further configured to: and responding to the subscription cancellation request information, and stopping pushing the state change parameter information to the user terminal.
In a seventh aspect, an embodiment of the present invention further provides a server, where the server includes: at least one memory and at least one processor;
The at least one memory is used for storing one or more programs;
The method of any one of the possible designs of the second aspect described above is implemented when the one or more programs are executed by the at least one processor.
In an eighth aspect, embodiments of the present invention also provide a computer-readable storage medium storing at least one program; the at least one program, when executed by a processor, implements the method as referred to by any one of the possible designs of the first aspect described above, or implements the method as referred to by any one of the possible designs of the second aspect described above.
The beneficial technical effects of the invention are as follows:
In the technical scheme provided by the embodiment of the invention, the user side sends the first subscription request information to the server side based on the content requirement of the first page which is currently displayed, subscribes to at least one first parameter module corresponding to the first subscription theme which is required, and the server side only pushes the first state change parameter information related to the at least one first parameter module to the user side when the parameters of the at least one parameter module change, and does not need to continuously push all state change information related to the first subscription theme to the user side, and the user side only needs to receive the required first state change parameter information, so that the frequency and the data quantity of the data pushed to the user side by the server side can be reduced, and the effects of reducing the flow consumption of the server side and the user side and reducing the cost of message pushing can be achieved.
For a better understanding and implementation, the present invention is described in detail below with reference to the drawings.
Drawings
Fig. 1 is a flow chart of a message receiving method according to an embodiment of the present invention;
fig. 2 is a flow chart of another message receiving method according to an embodiment of the present invention;
fig. 3 is a schematic flow chart of a message pushing method according to an embodiment of the present invention;
fig. 4 is a flow chart of another message pushing method according to an embodiment of the present invention;
Fig. 5 is a schematic diagram of a network communication system according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a user terminal according to an embodiment of the present invention;
Fig. 7 is a schematic structural diagram of a user equipment according to an embodiment of the present invention;
Fig. 8 is a schematic structural diagram of a server according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of another server provided in an embodiment of the present invention.
Detailed Description
The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of implementations consistent with aspects of the present disclosure.
The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in this disclosure, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
Unless stated to the contrary, the embodiments of the present invention refer to ordinal terms such as "first," "second," etc., for distinguishing between multiple objects and not for defining a sequence, timing, priority, or importance of the multiple objects.
The client referred to in the embodiments of the present invention is a program for providing local services to a user, including but not limited to Application (APP), platform web page, browser, and WeChat applet.
The server referred to in the embodiments of the present invention is a computer system that provides certain services (such as an information subscription service) to other machines on a network, and may also be referred to as a server.
Various technical schemes provided by the embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
Referring to fig. 1, the message receiving method provided by the embodiment of the invention includes the following steps:
S101, sending first subscription request information to a server based on the content requirement of a first page currently displayed by a user side.
In some embodiments, the client is connected to the server through the MQTT protocol, the client may subscribe to the server as a subscriber, and the server may push a corresponding message to the client based on the message subscribed by the client.
In some embodiments, the server may configure a plurality of subscription topics, each subscription topic configuring at least one parameter module. For example, the subscription theme configured by the server may be set according to the type attribute of the device, for example, in an application scenario of the intelligent internet of things, the server may set a corresponding subscription theme based on the device with different types of attributes, such as the cleaning robot, the intelligent sound equipment, the intelligent air conditioner, and the like. The server side may set at least one parameter module according to a working attribute (or a service requirement) of the device side, for example, taking a cleaning robot as an example, where the at least one parameter module configured by a subscription theme corresponding to the cleaning robot may include a battery power parameter module, a water tank water quantity parameter module, a movement track parameter module, and the like.
In a specific implementation process, the first subscription request information includes a first subscription topic required by the user side and at least one first parameter module corresponding to the first subscription topic.
In a specific implementation process, the user side may set different pages, for example, taking the user side as a WeChat APP as an example, where the WeChat APP is set with different pages such as a friend circle page and an address book page. The user can operate the user side to display the corresponding page according to the own requirement, such as operating the WeChat APP to display the friend circle page.
For example, if the content requirement of the first page is the battery power state of the cleaning robot, the first subscription topic required by the user side is the subscription topic corresponding to the cleaning robot, and the at least one first parameter module includes the battery power parameter module.
Because the state parameters of the equipment end are numerous and the state parameters are changed frequently, if the user end obtains the overall state change parameter information of the equipment end, the problems of high frequency and large data volume of the message pushed by the user end to the server end exist, and the flow consumption of the user end is large. In the embodiment of the invention, by configuring a plurality of subscription topics at the server, each subscription topic is configured with a plurality of parameter modules, so that a certain parameter module or a certain parameter modules (such as corresponding parameter modules required by subscribing only the first page displayed at present) in the required subscription topics can be conveniently transmitted when the user terminal subscribes, state change parameter information related to the certain module or modules is acquired in real time, and all parameter information related to the subscription topic does not need to be acquired, thereby reducing the flow consumption of the user terminal and achieving the effect of reducing the cost of receiving the information by the user terminal.
S102, after the server side is determined to respond to the first subscription request information, the first activation request information sent to the server side by calling a first HTTPS interface is sent.
In a specific implementation process, the first activation request information is used for indicating to push first state change parameter information related to at least one first parameter module to the user side. The first state change parameters are acquired from at least one device side by the service side based on a first subscription theme. For example, taking the equipment end as an example of a cleaning robot, if a plurality of cleaning robots with the same type of attribute are used, the server end can respectively obtain state change parameter information (including first state change parameter information) of the plurality of cleaning robots from the plurality of cleaning robots based on subscription subjects corresponding to the cleaning robots. Of course, if in an application scenario of multiple device ends with the same type of attribute, when the user end only needs some parameter modules of a certain device end, the identification information (e.g. serial number) of the device end may be added to the subscription theme configured by the server end to identify different device ends with the same type of attribute.
In a specific implementation process, after the user side sends the first subscription request information to the server side, whether the server side responds to the first subscription request information can be monitored. Or after the server responds to the first subscription request information, the indication information can be fed back to the user side, wherein the indication information is used for indicating that the server responds to the first subscription request information. After the user receives the indication information, the user can determine that the server responds to the first subscription request information.
In a specific implementation process, after the user side determines that the server side responds to the first subscription request information, the user side invokes a first hypertext transfer security protocol (Hyper Text Transfer Protocol over Secure Socket Layer, HTTPS) interface to send first activation request information to the server side. The user side and the server side may communicate through a plurality of HTTPS interfaces, and the first HTTPS interface is an idle HTTPS interface of the plurality of HTTPS interfaces, or may be an HTTPS interface predefined for the user side to send corresponding activation request information to the server side, which is not limited by the embodiment of the invention.
In the prior art, after subscribing a corresponding subscription topic, a server side immediately starts to push related messages of the subscription topic to the user side, and under the development scene of the multi-user side, the situation that the user side subscribes to messages under the condition of unnecessary demands, thereby causing redundant traffic consumption is easy to occur. In the embodiment of the invention, the specification of the data transmission is actively activated by limiting the HTTPS interface, and the user side only calls the first HTTPS interface to send the first activation request information to the server side after determining that the server side responds to the first subscription request information, so that the server side is informed to start pushing the first state change parameter information to the user side, thereby avoiding unnecessary flow consumption and further achieving the effect of reducing the cost of the user side for receiving the information.
S103, receiving first state change parameter information which is pushed by the server side after responding to the first activation request information, and displaying the first state change parameter information through a first page.
In some embodiments, after receiving the first activation request information from the ue, the server starts pushing the first state change parameter information to the ue. Correspondingly, the user receives the first state change parameter information from the server.
In some embodiments, after receiving the first state change parameter information, the user displays the first state change parameter information through the first page, so that the user can conveniently view the first state change parameter information through the first page.
As can be seen from the above description, in the embodiment of the present invention, the user side sends the first subscription request information to the server side based on the content requirement of the first page currently displayed, subscribes to at least one first parameter module corresponding to the first subscription topic required by the subscription, and the user side only needs to acquire the state change parameter information related to the at least one first parameter module in real time, and does not need to continuously acquire all parameter information related to the first subscription topic, thereby reducing the flow consumption of the user side and achieving the effect of reducing the cost of receiving the message by the user side.
In an applicable scenario provided by the embodiment of the present invention, as shown in fig. 1-2, the message receiving method provided by the embodiment of the present invention further includes the following steps:
And S104, if the preset operation is monitored, sending subscription cancellation request information to the server so that the server stops pushing the first state change parameter information to the user side.
In a specific implementation process, the subscription cancellation request information is used for indicating the user side to cancel subscribing to the first subscription topic.
In a specific implementation process, the user side monitors the operation of the user on the user side, and if the operation of the user is determined to belong to a preset operation, the user side can unsubscribe from the first state change parameter information and send subscription cancellation request information to the server side, wherein the user is not required to view the related content of the first page currently displayed by the user side. Correspondingly, after receiving the subscription cancellation request information from the user terminal, the server terminal can determine that the user terminal does not need the subscription information, and based on the subscription cancellation request information, the server terminal stops pushing the first state change parameter information to the user terminal.
In a specific implementation process, the preset operation is one of the following operations:
Executing background operation by the user side;
the user side jumps to other pages from the first page;
Installing user equipment of a user to enter a screen-extinguishing or screen-locking state;
and switching the first page to web pages of other clients.
Because the MQTT protocol connection belongs to long connection, after the user terminal subscribes to the corresponding message, the server terminal can continuously push the message to the user terminal, but the situation that the user uses the user terminal is changed greatly, the user terminal can continuously receive the message when the user is not in the condition that the user needs to check the message, and the flow consumption of the user terminal is caused to be larger. In the embodiment of the invention, the user side can dynamically cancel the corresponding parameter module in the subscription subject required by subscription according to the real-time use state of the user by monitoring the operation of the user on the user side, so that the redundant flow consumption can be avoided on the premise of ensuring that the function use of the user side is not influenced, the user experience is improved, and the cost of the user side for receiving the message is reduced.
In another applicable scenario provided by the embodiment of the present invention, the user side may dynamically subscribe to a corresponding parameter module in the required subscription theme according to the real-time usage state of the user.
The following will specifically describe several cases of corresponding parameter modules in the subscription theme required by the user terminal for dynamically subscribing according to the real-time use state of the user.
Case one
If the user side monitors that the user side runs from the background to the foreground, the user side determines whether the second page currently displayed by the user side needs to subscribe to the message. If the user side determines that the second page does not need to subscribe to the message, the user side determines that the message does not need to be subscribed to the server side. Or if the user side determines that the second page needs to subscribe to the message, the user side sends second subscription request information to the server side based on the content requirement of the second page. The second subscription request information comprises a second subscription topic required by the user side and at least one second parameter module corresponding to the second subscription topic.
After the user side determines that the server side responds to the second subscription request information, the user side invokes a second HTTPS interface to send second activation request information to the server side. The second activation request information is used for indicating to push second state change parameter information related to at least one second parameter module to the user side. The second state change parameter is obtained from at least one device side by the server side based on a second subscription theme.
The user side receives second state change parameter information which is pushed by the server side after responding to the second activation request information, and displays the second state change parameter information through a second page.
It should be noted that the second page may be the same as or different from the first page, and the second HTTPS interface may be the same as or different from the first HTTPS interface, which is not limited by the embodiment of the present invention.
In the first case, the manner in which the user side subscribes to the server side based on the second page currently displayed and receives and displays the second state change parameter information related to the at least one second parameter module is the same as or similar to the manner in which the user side subscribes to the server side based on the first page currently displayed and receives and displays the first state change parameter information related to the at least one first parameter module, which is shown in fig. 1-2, and is not repeated herein.
Case two
If the user side monitors that the user side returns to the first page from other pages, the user side can return to execute the flow of the message receiving method shown in the above figures 1-2.
Case three
If the user side monitors that the user equipment is recovered from the screen-off state or the screen-locking state to the screen-on display first page, the user side can return to execute the flow of the message receiving method shown in the above figures 1-2.
Case four
If the user side monitors that the user switches back to the first page from the web pages of other user sides, the user side may return to the process of executing the message receiving method shown in fig. 1-2.
In the embodiment of the invention, the user terminal can dynamically subscribe the corresponding parameter module in the required subscription theme according to the real-time use state of the user by monitoring the operation of the user on the user terminal, so that the relevant state change parameter information of the corresponding parameter module required by message subscription can be recovered in time on the premise of ensuring that the use of the functions of the user terminal is not influenced, the consumption of redundant flow can be avoided, the user experience can be improved, and the cost of the user terminal for receiving the message can be reduced.
It should be noted that, the foregoing takes the execution body of the message receiving method as the user side as an example, and in a specific implementation process, the execution body of the message receiving method may also be a user device installed on the user side, or other devices communicatively connected to the user device, which is not limited by the embodiment of the present invention.
Based on the same inventive concept, the embodiment of the invention also provides a message pushing method. 1-3, the message pushing method provided by the embodiment of the invention comprises the following steps:
S201, receiving subscription request information sent by a user side based on the content requirement of a first page which is currently displayed, wherein the subscription request information comprises a subscription theme required by the user side and at least one parameter module corresponding to the subscription theme.
In some embodiments, the client is connected to the server through the MQTT protocol, the client may subscribe to the server as a subscriber, and the server may push a corresponding message to the client based on the message subscribed by the client.
In a specific implementation process, the server may configure a plurality of subscription topics, and each subscription topic is configured with at least one parameter module, which can be specifically described in the above step S101, and will not be described herein.
S202, responding to the subscription request information, and acquiring state change parameter information related to at least one parameter module from at least one equipment terminal based on the subscription theme.
In some embodiments, after receiving subscription request information from a user terminal, the server terminal can determine that the user terminal needs to subscribe to at least one parameter module corresponding to the subscription topic based on the subscription request information, and obtain state change parameter information related to the at least one parameter module from at least one equipment terminal, so that dynamic change parameter information related to the at least one parameter module can be pushed to the user terminal in a targeted manner at a subsequent time, further, flow consumption of the server terminal can be reduced, and the effect of reducing the cost of pushing messages by the server terminal is achieved.
S203, receiving activation request information sent by the user side through calling the HTTPS interface.
In a specific implementation process, the activation request information is used for indicating to push the state change parameter information to the user side;
In a specific implementation process, the specific implementation process of step S203 may refer to the description related to step S102, which is not described herein.
S204, responding to the activation request information, pushing the state change parameter information to the user side so that the user side displays the state change parameter information through a first page.
In a specific implementation process, the specific implementation process of step S204 may refer to the descriptions related to steps S102-S103, which are not described herein.
As can be seen from the above description, in the embodiment of the present invention, by limiting the specification of actively activating data transmission by the HTTPS interface, the server starts to push state change parameter information related to at least one parameter module to the user only when the user receives activation request information sent by the user through the corresponding HTTPS interface and the parameter of at least one parameter module changes, without continuously pushing all state change information related to the first subscription theme to the user, so that the frequency and the data amount of data push by the server to the user can be reduced, thereby achieving the effects of reducing flow consumption of the server and the user, and reducing the cost of message push.
In an applicable scenario provided by the embodiment of the present invention, as shown in fig. 1 to 4, the flow of the message pushing method provided by the embodiment of the present invention further includes the following steps:
S205, receiving subscription cancellation request information sent by the user terminal, wherein the subscription cancellation request information is used for indicating the user terminal to cancel subscription to the subscription theme.
In some embodiments, the specific implementation procedure of step S205 may be referred to the above description of step S104.
S206, responding to the subscription cancellation request information, and stopping pushing the state change parameter information to the user terminal.
In a specific implementation process, after receiving the subscription cancellation request information from the user terminal, the server terminal can determine that the user terminal does not need to subscribe to the state change parameter information currently, and stops pushing the state change parameter information to the user terminal.
In the embodiment of the invention, the server can dynamically stop pushing the state change parameter information of the corresponding parameter module to the user according to the subscription cancellation request information from the user, so that the redundant flow consumption can be avoided on the premise of ensuring that the function use of the user is not influenced, the user experience is improved, and the cost of pushing the message by the server is reduced.
In the embodiment of the invention, when the running state of the user terminal or the screen state of the user equipment provided with the user terminal changes, the service terminal can dynamically execute the flow of the message pushing method shown in the figures 3-4, so that the redundant flow consumption can be avoided on the premise of ensuring that the function use of the user terminal is not influenced, the user experience is improved, and the cost of pushing the message by the service terminal is reduced.
It should be noted that, the foregoing takes the execution body of the message pushing method as the server as an example, and in a specific implementation process, the execution body of the message pushing method may also be other devices that are communicatively connected to the server.
Based on the same inventive concept, the embodiment of the invention also provides a network communication system. As shown in connection with fig. 1-5, the network communication system 300 includes: the client 301 and the server 302 are connected through an MQTT protocol; wherein,
The client 301 is configured to implement some or all of the steps shown in fig. 1-2 and implement the corresponding operation behaviors of the client.
The server 302 is configured to implement some or all of the steps shown in fig. 1-2 and implement the corresponding operation behaviors of the server.
Based on the same inventive concept, the embodiment of the invention also provides a user terminal. As shown in fig. 6, the client 400 includes:
the processing unit 401 is configured to send first subscription request information to a server connected to the user through an MQTT protocol, where the first subscription request information includes a first subscription topic required by the user and at least one first parameter module corresponding to the first subscription topic;
The processing unit 401 is further configured to determine, after the server responds to the first subscription request information, first activation request information sent to the server by calling a first HTTPS interface, where the first activation request information is used to instruct pushing, to the user, first state change parameter information related to at least one first parameter module, where the first state change parameter is acquired by the server from at least one device based on a first subscription theme;
and the display unit 402 is configured to receive the first state change parameter information pushed by the server in response to the first activation request information, and display the first state change parameter information through the first page.
In one possible design, the processing unit 401 is further configured to:
If the following preset operation is monitored, sending subscription cancellation request information to the server, wherein the subscription cancellation request information is used for indicating the user to cancel subscribing to a first subscription theme so as to enable the server to stop pushing first state change parameter information to the user;
The preset operation is one of the following operations:
Executing background operation by the user side;
the user side jumps to other pages from the first page;
Installing user equipment of a user to enter a screen-extinguishing or screen-locking state;
and switching the first page to web pages of other clients.
In one possible design, the processing unit 401 is further configured to:
If the user side is monitored to return to the foreground operation from the background operation, determining whether the second page currently displayed by the user side needs to subscribe to the message or not;
If the second page is determined to need to subscribe to the message, sending second subscription request information to the server based on the content requirement of the second page, wherein the second subscription request information comprises a second subscription topic required by the user side and at least one second parameter module corresponding to the second subscription topic;
After determining that the server responds to the second subscription request information, invoking second activation request information sent to the server by a second HTTPS interface, wherein the second activation request information is used for indicating to push second state change parameter information related to at least one second parameter module to the user, and the second state change parameter is acquired from at least one equipment end by the server based on a second subscription theme;
the display unit 402 is further configured to: and receiving second state change parameter information which is pushed by the server side after responding to the second activation request information, and displaying the second state change parameter information through a second page.
In one possible design, the processing unit 401 is further configured to:
if the user side is monitored to return to the first page from other pages, returning to execute the content requirement based on the first page currently displayed by the user side, and sending first subscription request information to a server side connected with the user side through an MQTT protocol.
In one possible design, the processing unit 401 is further configured to:
If the user equipment is monitored to recover to the bright screen display first page from the screen-off or screen-locking state, returning to execute the content requirement based on the first page currently displayed by the user end, and sending first subscription request information to a server end connected with the user end through an MQTT protocol.
In one possible design, the processing unit 401 is further configured to:
if the user is monitored to switch back to the first page from the web pages of other user terminals, the content requirement based on the first page currently displayed by the user terminal is returned to be executed, and first subscription request information is sent to a server terminal connected with the user terminal through an MQTT protocol.
The implementation process of the user terminal 400 in this embodiment of the present invention can be clearly understood by those skilled in the art through the foregoing detailed description of the message receiving method according to the embodiment of the present invention based on the same concept as the message receiving method shown in fig. 1-2, so that the description is omitted herein for brevity.
It should be noted that, in the specific implementation process, the client 400 may be the client 301 shown in fig. 5.
Based on the same inventive concept, the embodiment of the invention also provides user equipment. As shown in fig. 7, the user equipment 500 may include: at least one memory 501 and at least one processor 502. Wherein:
At least one memory 501 is used to store one or more programs.
The message reception method illustrated in fig. 1-2 described above is implemented when one or more programs are executed by the at least one processor 502.
The user device 500 may also optionally include a communication interface for communicating with external devices and for data interactive transmissions.
It should be noted that the memory 501 may include a high-speed RAM memory, and may further include a nonvolatile memory (nonvolatile memory), such as at least one magnetic disk memory.
In a specific implementation, if the memory 501, the processor 502, and the communication interface are integrated on a chip, the memory 501, the processor 502, and the communication interface may communicate with each other through an internal interface. If the memory 501, the processor 502, and the communication interface are implemented independently, the memory 501, the processor 502, and the communication interface may be connected to each other and perform communication with each other through a bus.
It should be noted that, in the specific implementation process, the ue 500 may be used as a ue to which the ue 301 shown in fig. 5 is installed.
Based on the same inventive concept, the embodiment of the invention also provides a server. As shown in fig. 8, the server 600 includes:
The receiving unit 601 is configured to receive subscription request information sent by a user terminal connected through an MQTT protocol based on a content requirement of a first page that is currently displayed, where the subscription request information includes a subscription topic required by the user terminal and at least one parameter module corresponding to the subscription topic;
A processing unit 602, configured to respond to the subscription request information, and obtain, from at least one device side, state change parameter information related to at least one parameter module based on the subscription topic;
the receiving unit 601 is further configured to receive activation request information sent by the user side through invoking the HTTPS interface, where the activation request information is used to indicate pushing state change parameter information to the user side;
the processing unit 602 is further configured to push the state change parameter information to the client in response to the activation request information, so that the client displays the state change parameter information through the first page.
In one possible design, the receiving unit 601 is further configured to: receiving subscription cancellation request information sent by a user side, wherein the subscription cancellation request information is used for indicating the user side to cancel subscription topics;
the processing unit 602 is further configured to: and stopping pushing the state change parameter information to the user terminal in response to the subscription cancellation request information.
The server 600 in the embodiment of the present invention and the message pushing method shown in fig. 3 to 4 are based on the same concept, and by the foregoing detailed description of the message pushing method, those skilled in the art can clearly understand the implementation process of the server 600 in the embodiment, so that, for brevity of the description, the description is omitted herein.
It should be noted that, in the specific implementation process, the server 600 may be the server 302 shown in fig. 5.
Based on the same inventive concept, the embodiment of the invention also provides another service end. As shown in fig. 9, the server 700 may include: at least one memory 701 and at least one processor 702. Wherein:
at least one memory 701 is used to store one or more programs.
The message pushing methods illustrated in fig. 3-4 described above are implemented when one or more programs are executed by the at least one processor 702.
The server 700 may also optionally include a communication interface for communicating with external devices and for data interactive transmissions.
It should be noted that the memory 701 may include a high-speed RAM memory, and may further include a nonvolatile memory, such as at least one magnetic disk memory.
In a specific implementation, if the memory 701, the processor 702, and the communication interface are integrated on a chip, the memory 701, the processor 702, and the communication interface may communicate with each other through internal interfaces. If the memory 701, the processor 702, and the communication interface are implemented independently, the memory 701, the processor 702, and the communication interface may be connected to each other through a bus and perform communication with each other.
It should be noted that, in the specific implementation process, the server 700 may be used as the server 302 shown in fig. 5.
Based on the same inventive concept, the embodiments of the present invention also provide a computer readable storage medium, which may store at least one program, and when the at least one program is executed by a processor, implement the message receiving method shown in fig. 1-2 or implement the message pushing method shown in fig. 3-4.
It should be appreciated that a computer readable storage medium is any data storage device that can store data or a program, which can thereafter be read by a computer system. Examples of the computer readable storage medium include: read-only memory, random access memory, CD-ROM, HDD, DVD, magnetic tape, optical data storage devices, and the like.
The computer readable storage medium can also be distributed over network coupled computer systems so that the computer readable code is stored and executed in a distributed fashion.
Program code embodied on a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, radio Frequency (RF), or the like, or any suitable combination of the foregoing.
The foregoing examples illustrate only a few embodiments of the invention, which are described in detail and are not to be construed as limiting the scope of the invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention.
Claims (10)
1. A message receiving method, comprising:
Based on the content requirement of a first page currently displayed by a user side, sending first subscription request information to a server side connected with the user side through an MQTT protocol, wherein the first subscription request information comprises a first subscription topic required by the user side and at least one first parameter module corresponding to the first subscription topic;
After the server responds to the first subscription request information, first activation request information sent to the server by calling a first HTTPS interface is determined, wherein the first activation request information is used for indicating to push first state change parameter information related to the at least one first parameter module to the user, and the first state change parameter is acquired from at least one equipment end by the server based on the first subscription theme;
and receiving the first state change parameter information which is pushed by the server side after responding to the first activation request information, and displaying the first state change parameter information through the first page.
2. The method of claim 1, wherein after the first state change parameter information is presented via the first page, the method further comprises:
If the following preset operation is monitored, sending subscription cancellation request information to the server, wherein the subscription cancellation request information is used for indicating the user side to cancel subscription to the first subscription theme so that the server stops pushing the first state change parameter information to the user side;
The preset operation is one of the following operations:
the user side executes background operation;
The user side jumps to other pages from the first page;
Installing the user equipment of the user terminal to enter a screen-extinguishing or screen-locking state;
and switching the first page to web pages of other clients.
3. The method of claim 2, wherein the method further comprises:
If the user side is monitored to return to the foreground operation from the background operation, determining whether the second page currently displayed by the user side needs to subscribe to the message or not;
If the second page is determined to need to subscribe to the message, second subscription request information is sent to the server based on the content requirement of the second page, wherein the second subscription request information comprises a second subscription topic required by the user side and at least one second parameter module corresponding to the second subscription topic;
After determining that the server responds to the second subscription request information, invoking a second HTTPS interface to send second activation request information to the server, wherein the second activation request information is used for indicating to push second state change parameter information related to the at least one second parameter module to the user, and the second state change parameter is acquired from the at least one equipment end by the server based on the second subscription theme;
and receiving the second state change parameter information pushed by the server in response to the second activation request information, and displaying the second state change parameter information through the second page.
4. The method of claim 2, wherein the method further comprises:
If the user side is monitored to return to the first page from the other pages, returning to execute the content requirement based on the first page currently displayed by the user side, and sending first subscription request information to a server side connected with the user side through an MQTT protocol.
5. The method of claim 2, wherein the method further comprises:
And if the user equipment is monitored to recover to the screen-on display state from the screen-off state or the screen-locking state to display the first page, returning to execute the content requirement based on the first page currently displayed by the user side, and sending first subscription request information to a server side connected with the user side through an MQTT protocol.
6. The method of claim 2, wherein the method further comprises:
if the user is monitored to switch back to the first page from the web pages of the other user terminals, the content requirement based on the first page currently displayed by the user terminal is returned to be executed, and first subscription request information is sent to a server terminal connected with the user terminal through an MQTT protocol.
7. A message pushing method, comprising:
receiving subscription request information sent by a user terminal connected through an MQTT protocol based on the content requirement of a first page which is currently displayed, wherein the subscription request information comprises a subscription topic required by the user terminal and at least one parameter module corresponding to the subscription topic;
Responding to the subscription request information, and acquiring state change parameter information related to at least one parameter module from at least one equipment terminal based on the subscription theme;
receiving activation request information sent by the user side through invoking an HTTPS interface, wherein the activation request information is used for indicating to push the state change parameter information to the user side;
And responding to the activation request information, pushing the state change parameter information to the user side so that the user side displays the state change parameter information through the first page.
8. The method of claim 7, wherein after pushing the state change parameter to the user terminal in response to the activation request information, the method further comprises:
receiving subscription cancellation request information sent by the user side, wherein the subscription cancellation request information is used for indicating the user side to cancel subscribing the subscription theme;
and responding to the subscription cancellation request information, and stopping pushing the state change parameter information to the user terminal.
9. A network communication system, comprising: the system comprises a user terminal and a server terminal, wherein the user terminal and the server terminal are connected through an MQTT protocol; wherein,
The user side is used for sending subscription request information to the server side based on the content requirement of the first page which is currently displayed, wherein the subscription request information comprises a subscription topic required by the user side and at least one first parameter module corresponding to the subscription topic;
The server side is used for receiving and responding to the subscription request information, and acquiring state change parameter information related to the at least one parameter module from at least one equipment side based on the subscription theme;
The user side is further configured to determine activation request information sent to the server side by calling an HTTPS interface after the server side responds to the subscription request information, where the activation request information is used to instruct pushing state change parameter information related to the at least one parameter module to the user side;
the server is further configured to receive and respond to the activation request information, and push the state change parameter information to the user;
The user side is further configured to display the state change parameter information through the first page.
10. A computer-readable storage medium, wherein the computer-readable storage medium stores at least one program; the at least one program, when executed by a processor, performs the method of any of claims 1-6, or performs the method of claim 7 or 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210143554.1A CN114520827B (en) | 2022-02-16 | 2022-02-16 | Message receiving method, pushing method, system and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210143554.1A CN114520827B (en) | 2022-02-16 | 2022-02-16 | Message receiving method, pushing method, system and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114520827A CN114520827A (en) | 2022-05-20 |
CN114520827B true CN114520827B (en) | 2024-05-10 |
Family
ID=81599919
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210143554.1A Active CN114520827B (en) | 2022-02-16 | 2022-02-16 | Message receiving method, pushing method, system and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114520827B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115292472B (en) * | 2022-10-09 | 2022-12-30 | 四川师范大学 | Method and system for pushing applet message |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102118735A (en) * | 2010-01-05 | 2011-07-06 | 中兴通讯股份有限公司 | Method for realizing data subscription notification based on lightweight directory access protocol |
CN109495524A (en) * | 2017-09-11 | 2019-03-19 | 华为技术有限公司 | A kind of method, apparatus and system of Internet of Things resource subscription |
CN111008032A (en) * | 2019-12-30 | 2020-04-14 | 深圳前海微众银行股份有限公司 | Page data updating method and device |
CN111294317A (en) * | 2018-12-07 | 2020-06-16 | 北京新媒传信科技有限公司 | Method and device for RCS to support multi-protocol access and electronic equipment |
WO2021232197A1 (en) * | 2020-05-18 | 2021-11-25 | Oppo广东移动通信有限公司 | Method and apparatus for monitoring device state, device, and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104426956B (en) * | 2013-08-28 | 2018-10-12 | 华为技术有限公司 | A kind of SOT state of termination method for subscribing, apparatus and system |
-
2022
- 2022-02-16 CN CN202210143554.1A patent/CN114520827B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102118735A (en) * | 2010-01-05 | 2011-07-06 | 中兴通讯股份有限公司 | Method for realizing data subscription notification based on lightweight directory access protocol |
CN109495524A (en) * | 2017-09-11 | 2019-03-19 | 华为技术有限公司 | A kind of method, apparatus and system of Internet of Things resource subscription |
CN111294317A (en) * | 2018-12-07 | 2020-06-16 | 北京新媒传信科技有限公司 | Method and device for RCS to support multi-protocol access and electronic equipment |
CN111008032A (en) * | 2019-12-30 | 2020-04-14 | 深圳前海微众银行股份有限公司 | Page data updating method and device |
WO2021232197A1 (en) * | 2020-05-18 | 2021-11-25 | Oppo广东移动通信有限公司 | Method and apparatus for monitoring device state, device, and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN114520827A (en) | 2022-05-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR20110076954A (en) | Optimized polling in low resource devices | |
CN112788074B (en) | Data transmitting method, processing method, receiving method, apparatus thereof, and storage medium | |
CN104980898A (en) | Information pushing method, system and equipment | |
CN104378221A (en) | Asynchronous calling method applied to integrated circuit production line monitoring system | |
CN114520827B (en) | Message receiving method, pushing method, system and medium | |
CN105183299A (en) | Human-computer interface service processing system and method | |
CN113391979A (en) | Processing method, equipment and system for monitoring data display and storage medium | |
CN111736938B (en) | Information display method and device, storage medium and electronic device | |
CN110297722A (en) | Thread task communication method and Related product | |
CN112532673A (en) | Message sending method and device, computer readable storage medium and electronic equipment | |
CN101808132A (en) | Communication method of application layer in CAN bus system | |
CN100558142C (en) | A kind of method, application and device that changes application state in a plurality of current service | |
CN103716230A (en) | Message sending method, device and server | |
CN114153559A (en) | Cloud platform log acquisition method, device, equipment and readable storage medium | |
CN110351146A (en) | A kind of server-side example determines method, system, client and storage medium | |
CN102185881A (en) | Household digital equipment wireless multi-protocol space sharing storage manager and method | |
CN111064639A (en) | Service state announcement method, device, equipment and storage medium | |
CN114900558B (en) | Universal equipment management protocol control method and device | |
CN115883639A (en) | Web real-time message pushing method and device, equipment and storage medium | |
CN113094165A (en) | Method for increasing speed of loading application program at cloud end | |
CN108174458B (en) | Method and device for wireless connection between mobile terminal and wearable device, mobile terminal and wearable device | |
CN110493070A (en) | Suspension notification method and its application system | |
CN112187698B (en) | Communication method, service system, electronic equipment and host MCU (micro control Unit) of electronic equipment | |
CN114157725B (en) | Method, device, server, electronic equipment and storage medium for equipment linkage | |
CN117560419A (en) | Message pushing method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |