Device status updating method, device, computer device and storage medium

By establishing and maintaining long connections in scenarios where timely data interaction is required, and using short connection polling when long connection fails, the problem of excessive server load caused by short connection polling is solved, and data transmission efficiency and reliability are improved .

CN114281373BActive Publication Date: 2025-01-10TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111064108.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-10
Publication Date
2025-01-10
Estimated Expiration
2041-09-10

AI Technical Summary

Technical Problem

In scenarios where timely data interaction is required, short connection polling leads to large computing overhead of servers, excessive backend load, and long-term use of transmission channels, affecting efficiency.

Method used

By establishing and maintaining long connections, disconnecting and re-establishing if long connection fails, short connection polling is used to maintain communication status, ensuring data transmission efficiency and reducing background load.

Benefits of technology

It effectively reduces the computing overhead and background load of the server, improves data transmission efficiency, ensures that normal communication is maintained through short connections when long connections fail, and avoids the impact of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114281373B_ABST
    Figure CN114281373B_ABST
Patent Text Reader

Abstract

The present application relates to a device status update method, apparatus, computer equipment and storage medium. The method is applied to a multimedia session device, and includes: establishing a long connection between a locally running first application and a server, and maintaining a communication status with the server through the long connection; if the long connection is in an invalid state, disconnecting the long connection and re-establishing a new long connection; in the process of re-establishing a new long connection, starting short connection polling to maintain the communication status with the server until a valid long connection is re-established; in the process of maintaining the communication status, if a user account belonging to the second application is bound to a device account belonging to the first application, receiving an operation result obtained by an operation on the device account triggered by the user account and fed back by the server; and updating the device status of the electronic device based on the operation result. The use of this method can reduce the load on the background.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a device status updating method, apparatus, computer equipment and storage medium. Background Art

[0002] A short connection means that during the data transmission process, a connection is established only when data needs to be sent. After the data is sent, the connection is disconnected, that is, each connection only completes the sending of one business. Using a short connection for data exchange does not require the transmission channel to be occupied for a long time, which can save the use of the transmission channel.

[0003] However, in some scenarios where timely data interaction is required, a new network connection needs to be established each time in short connection polling. If a security protocol exists, an SSL (Security Socket Layer) handshake is required. These processes impose a large computing overhead on the server, resulting in excessive background load. Summary of the invention

[0004] Based on this, it is necessary to provide a device status update method, apparatus, computer equipment and storage medium that can reduce the background load in response to the above technical problems.

[0005] A device status updating method, executed by an electronic device, comprising:

[0006] Establishing a persistent connection between the first application running locally and the server, and maintaining a communication state with the server through the persistent connection;

[0007] If the persistent connection is in an invalid state, disconnect the persistent connection and re-establish a new persistent connection;

[0008] In the process of re-establishing a new long connection, starting short connection polling to maintain the communication status with the server until a valid long connection is re-established;

[0009] In the process of maintaining the communication state, if the user account belonging to the second application is bound to the device account belonging to the first application, receiving the operation result obtained by the operation triggered by the user account on the device account fed back by the server;

[0010] The device status of the electronic device is updated based on the operation result.

[0011] A device status updating apparatus, executed by an electronic device, comprising:

[0012] An establishment module is used to establish a persistent connection between a first application running locally and a server, and maintain a communication state with the server through the persistent connection;

[0013] A reconstruction module, used for disconnecting the long connection and re-establishing a new long connection if the long connection is in an invalid state;

[0014] A polling module, used to start short connection polling to maintain the communication status with the server during the process of re-establishing a new long connection until a valid long connection is re-established;

[0015] a receiving module, configured to receive, during the process of maintaining the communication state, if a user account belonging to the second application is bound to a device account belonging to the first application, an operation result obtained by an operation triggered by the user account on the device account fed back by the server;

[0016] An updating module is used to update the device status of the electronic device based on the operation result.

[0017] In one embodiment, the establishment module is used to initiate a long connection establishment request to the server through a first application running locally to establish a long connection with the server; receive key information returned by the server based on the established long connection; generate a confirmation result based on the key information, and send the confirmation result to the server to maintain the communication status with the server.

[0018] In one embodiment, the device also includes a detection module; the detection module is used to send a heartbeat packet to the server through the long connection every first preset time period; if the heartbeat packet cannot be successfully sent to the server, it is determined that the long connection is in an invalid state; if the heartbeat packet is successfully sent to the server, but a response packet returned by the server for the heartbeat packet is not received within a first time period, it is determined that the long connection is in an invalid state.

[0019] In one embodiment, the detection module is also used to send a preset request to the server through the long connection every second preset time period; the second preset time period is greater than the first preset time period; if the preset request is not successfully sent to the server, it is determined that the long connection is in an invalid state; if the preset request is successfully sent to the server, but no response information returned by the server for the preset request is received within a second time period, it is determined that the long connection is in an invalid state.

[0020] In one embodiment, the polling module is also used to establish a short connection between the first application and the server during the process of re-establishing a new long connection; send a status query request to the server through the short connection polling until a valid long connection is re-established, and then stop the short connection polling; wherein each status query request sent is used for the electronic device to actively obtain the latest operation result, so as to update the device status of the electronic device in real time.

[0021] In one embodiment, the receiving module is also used to receive the operation result obtained by the operation on the device account triggered by the user account, which is actively returned by the server through the long connection, if the user account belonging to the second application is bound to the device account belonging to the first application during the process of maintaining the communication status through the long connection.

[0022] In one embodiment, the receiving module is also used to send a status query request to the server in each polling to maintain the communication status through the short connection polling, and if the user account belonging to the second application is bound to the device account belonging to the first application, then receive the response result of the status query request returned by the server through the short connection; the response result includes the operation result obtained by the operation on the device account triggered by the user account.

[0023] In one embodiment, the receiving module is further used to display a binding graphic code for binding to a device account belonging to the first application while maintaining a communication state; after a user account belonging to the second application scans the binding graphic code, the receiving module receives binding information returned by the server indicating that the user account has been bound to the device account; the updating module is further used to update the binding graphic code to a session graphic code based on the binding information and display the code; the session graphic code is used to create a session or join an already created session.

[0024] In one embodiment, the receiving module is further used to receive, after the user account is bound to the device account, session creation information sent by the server, which is obtained by a session creation operation triggered by the user account scanning the session graphic code and selecting a session member account; the updating module is further used to switch the currently displayed session graphic code to display content in the session state in response to the session creation information.

[0025] In one embodiment, the first application includes a session management application, the electronic device includes a multimedia session device for providing session room resources, and the second application includes an organization management application, and the second application provides session member accounts for participating in the session.

[0026] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0027] Establishing a persistent connection between the first application running locally and the server, and maintaining a communication state with the server through the persistent connection;

[0028] If the persistent connection is in an invalid state, disconnect the persistent connection and re-establish a new persistent connection;

[0029] In the process of re-establishing a new long connection, starting short connection polling to maintain the communication status with the server until a valid long connection is re-established;

[0030] In the process of maintaining the communication state, if the user account belonging to the second application is bound to the device account belonging to the first application, receiving the operation result obtained by the operation triggered by the user account on the device account fed back by the server;

[0031] The device status of the electronic device is updated based on the operation result.

[0032] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0033] Establishing a persistent connection between the first application running locally and the server, and maintaining a communication state with the server through the persistent connection;

[0034] If the persistent connection is in an invalid state, disconnect the persistent connection and re-establish a new persistent connection;

[0035] In the process of re-establishing a new long connection, starting short connection polling to maintain the communication status with the server until a valid long connection is re-established;

[0036] In the process of maintaining the communication state, if the user account belonging to the second application is bound to the device account belonging to the first application, receiving the operation result obtained by the operation triggered by the user account on the device account fed back by the server;

[0037] The device status of the electronic device is updated based on the operation result.

[0038] A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the following steps are implemented:

[0039] Establishing a persistent connection between the first application running locally and the server, and maintaining a communication state with the server through the persistent connection;

[0040] If the persistent connection is in an invalid state, disconnect the persistent connection and re-establish a new persistent connection;

[0041] In the process of re-establishing a new long connection, starting short connection polling to maintain the communication status with the server until a valid long connection is re-established;

[0042] In the process of maintaining the communication state, if the user account belonging to the second application is bound to the device account belonging to the first application, receiving the operation result obtained by the operation triggered by the user account on the device account fed back by the server;

[0043] The device status of the electronic device is updated based on the operation result.

[0044] The above-mentioned device status update method, apparatus, computer equipment, computer-readable storage medium and computer program product establish a long connection between the locally running first application and the server, and maintain the communication status with the server through the long connection, so that the communication between the first application and the server can be maintained for a long time, so that there is no need to re-establish communication with the server when sending and receiving data, thereby improving the efficiency of data sending and receiving, and reducing the background load.

[0045] If the long connection is in an invalid state, the long connection is disconnected and a new long connection is re-established. In the process of re-establishing the new long connection, short connection polling is started to maintain the communication status with the server until a valid long connection is re-established, so as to ensure that when the long connection fails, normal communication with the server can be maintained through the short connection to avoid data transmission and reception being affected. Whether in the process of maintaining the communication status through a long connection or a short connection, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account and fed back by the server is received, so that the device status of the electronic device can be updated timely and accurately based on the operation result.

[0046] A device status updating method, executed by a server, comprising:

[0047] Establishing a persistent connection with a first application and maintaining a communication state with the first application through the persistent connection, wherein the first application runs in the electronic device;

[0048] If the persistent connection is in an invalid state, disconnecting the persistent connection and re-establishing a new persistent connection is triggered;

[0049] In the process of re-establishing a new persistent connection, receiving a status query request sent by the first application in a short connection polling manner, so as to maintain the communication status with the first application through the status query request until a valid persistent connection is re-established;

[0050] In the process of maintaining the communication status, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account is obtained through the second application, and the operation result is returned to the first application to which the device account belongs; the operation result is used to instruct the first application to update the device status of the electronic device.

[0051] A device status updating device, executed by a server, comprising:

[0052] a persistent connection establishing module, configured to establish a persistent connection with a first application and maintain a communication state with the first application through the persistent connection, wherein the first application runs in the electronic device;

[0053] A long connection reestablishment module, used for triggering the disconnection of the long connection and reestablishing a new long connection if the long connection is in an invalid state;

[0054] A short connection polling module, used to receive a status query request sent by the first application in a short connection polling manner during the process of re-establishing a new long connection, so as to maintain the communication status with the first application through the status query request until a valid long connection is re-established;

[0055] A return module is used to, in the process of maintaining a communication status, if a user account belonging to a second application is bound to a device account belonging to the first application, obtain, through the second application, an operation result obtained by an operation on the device account triggered by the user account, and return the operation result to the first application to which the device account belongs; the operation result is used to instruct the first application to update the device status of the electronic device.

[0056] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0057] Establishing a persistent connection with a first application and maintaining a communication state with the first application through the persistent connection, wherein the first application runs in the electronic device;

[0058] If the persistent connection is in an invalid state, disconnecting the persistent connection and re-establishing a new persistent connection is triggered;

[0059] In the process of re-establishing a new persistent connection, receiving a status query request sent by the first application in a short connection polling manner, so as to maintain the communication status with the first application through the status query request until a valid persistent connection is re-established;

[0060] In the process of maintaining the communication status, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account is obtained through the second application, and the operation result is returned to the first application to which the device account belongs; the operation result is used to instruct the first application to update the device status of the electronic device.

[0061] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0062] Establishing a persistent connection with a first application and maintaining a communication state with the first application through the persistent connection, wherein the first application runs in the electronic device;

[0063] If the persistent connection is in an invalid state, disconnecting the persistent connection and re-establishing a new persistent connection is triggered;

[0064] In the process of re-establishing a new persistent connection, receiving a status query request sent by the first application in a short connection polling manner, so as to maintain the communication status with the first application through the status query request until a valid persistent connection is re-established;

[0065] In the process of maintaining the communication status, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account is obtained through the second application, and the operation result is returned to the first application to which the device account belongs; the operation result is used to instruct the first application to update the device status of the electronic device.

[0066] A computer program product includes a computer program, wherein when the computer program is executed by a processor, the following steps are implemented: establishing a persistent connection with a first application, and maintaining a communication state with the first application through the persistent connection, wherein the first application runs in an electronic device;

[0067] If the persistent connection is in an invalid state, disconnecting the persistent connection and re-establishing a new persistent connection is triggered;

[0068] In the process of re-establishing a new persistent connection, receiving a status query request sent by the first application in a short connection polling manner, so as to maintain the communication status with the first application through the status query request until a valid persistent connection is re-established;

[0069] In the process of maintaining the communication status, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account is obtained through the second application, and the operation result is returned to the first application to which the device account belongs; the operation result is used to instruct the first application to update the device status of the electronic device.

[0070] The above-mentioned device status update method, apparatus, computer equipment, computer-readable storage medium and computer program product, the first application runs in the electronic device, establishes a long connection with the first application, and maintains the communication status with the first application through the long connection, so that the communication between the first application and the server can be maintained for a long time, so that there is no need to re-establish communication with the server when sending and receiving data, thereby improving the efficiency of data sending and receiving, and reducing the background load.

[0071] If the long connection fails, a new long connection is re-established. In the process of re-establishing the new long connection, the status query request sent by the first application in the form of short connection polling is received, so as to maintain the communication status with the first application through the status query request until a valid long connection is re-established. This can ensure that when the long connection fails, normal communication with the server can be maintained through the short connection to avoid data transmission and reception being affected. Whether in the process of maintaining the communication status through a long connection or a short connection, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account is obtained through the second application, and the operation result is returned to the first application to which the device account belongs, so as to instruct the electronic device to update its own device status timely and accurately based on the operation result. BRIEF DESCRIPTION OF THE DRAWINGS

[0072] Figure 1 An application environment diagram of a device status updating method in an embodiment;

[0073] Figure 2 A schematic diagram of a flow chart of a device status updating method in one embodiment;

[0074] Figure 3 A timing diagram of establishing a long connection in one embodiment;

[0075] Figure 4 A timing diagram for establishing a short connection in one embodiment;

[0076] Figure 5 A schematic diagram of a process for updating the device status of an electronic device in one embodiment;

[0077] Figure 6 A schematic diagram of a QR code for binding with a conference APP in one embodiment;

[0078] Figure 7 This is a schematic diagram of an interface for binding enterprise WeChat and conference APP in one embodiment;

[0079] Figure 8 A schematic diagram of a session QR code for creating a conference in one embodiment;

[0080] Fig. 9 This is a schematic diagram of an interface for initiating a meeting on WeChat for Business in another embodiment;

[0081] Fig.10 A schematic diagram of an interface displayed in conference mode in another embodiment;

[0082] Fig.11 is a flow chart of a device status updating method in another embodiment;

[0083] Fig.12 It is a structural block diagram of a device status updating apparatus in one embodiment;

[0084] Fig.13 It is a structural block diagram of a device status updating apparatus in another embodiment;

[0085] Fig.14 FIG. 4 is a diagram showing the internal structure of an electronic device in one embodiment. DETAILED DESCRIPTION

[0086] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0087] The device status update method provided in this application can be applied to Figure 1 The device status shown in the figure updates the system. Figure 1As shown, the device status update system includes an electronic device 110, a user device 120 and a server 130. The electronic device 110 establishes a long connection between the first application running locally and the server 130, and maintains the communication status with the server 130 through the long connection. If the long connection is in an invalid state, the electronic device 110 disconnects the long connection and re-establishes a new long connection with the server 130. In the process of re-establishing a new long connection, the electronic device 110 starts short connection polling to maintain the communication status with the server 130 until a valid long connection is re-established. The second application runs on the user device 120, and the user account belonging to the second application operates the device account of the first application through the user device 120 to obtain the operation result. For example, the device account performs a scanning operation on the graphic code displayed on the electronic device to obtain the operation result. The user device 120 pushes the operation result to the server 130. In the process of maintaining the communication status between the first application and the server 130, if the user account of the second application is bound to the device account belonging to the first application, the electronic device 110 receives the operation result obtained by the operation on the device account triggered by the user account and fed back by the server 130. The electronic device 110 updates the device status based on the operation result. Among them, the server 130 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services or a cloud server cluster composed of multiple cloud servers. The electronic device 110 can be a multimedia conversation device, a tablet computer, a laptop computer, a desktop computer, a smart TV, etc., but is not limited to this. The user device 120 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, an intelligent voice interaction device, and a smart home appliance. The intelligent voice interaction device can be a smart speaker, a smart watch, and a car terminal, and the smart home appliance can be a smart TV, etc., but is not limited to this. The user device 120 and the server 120 can be directly or indirectly connected via wired or wireless communication, and this application is not limited here.

[0088] In one embodiment, multiple servers may form a blockchain, and the servers are nodes on the blockchain.

[0089] In one embodiment, data related to the device status update method can be saved on the blockchain, for example, data such as operation results and device status can be saved on the blockchain.

[0090] In one embodiment, Figure 2 As shown, a device status update method is provided, which is applied to Figure 1 The electronic device in the example is used to illustrate, and the following steps are included:

[0091] Step S202: Establish a persistent connection between the first application running locally and the server, and maintain the communication status with the server through the persistent connection.

[0092] Among them, long connection means that multiple data can be sent continuously on a connection. Short connection is a concept relative to long connection. It means that during the data transmission process, a connection is established only when data needs to be sent, and the connection is disconnected after receiving a response to the sent data, that is, each connection completes only one data transmission.

[0093] The first application runs on the electronic device. The first application may be a session management application, an instant messaging application, an SNS (Social Network Sites) application, a video application, a game application, a music application, a UGC (User Generated Content) application, etc., but is not limited thereto.

[0094] After logging into the first application running on the electronic device through the device account, the electronic device establishes a long connection with the server, and maintains the communication status between the electronic device and the server through the long connection.

[0095] Step S204: If the persistent connection is in an invalid state, disconnect the persistent connection and re-establish a new persistent connection.

[0096] Among them, the failure state refers to a state in which data cannot be sent or received normally. The electronic device can detect the state of the long connection with the server, and the state of the long connection includes a valid state and a failure state. The valid state refers to a state in which data can be sent and received normally. When the electronic device detects that the long connection with the server is in an invalid state, the long connection with the server is disconnected. After disconnecting the long connection with the server, try to re-establish the long connection with the server.

[0097] In one embodiment, after disconnecting the long connection with the server, the electronic device may establish a short connection with the server and maintain communication with the server through short connection polling. Short connection polling means that when the electronic device needs to send data, a connection is established with the server, and the connection is disconnected after receiving the response data from the server, and a connection is established with the server again after a preset time interval to send data. The connection is disconnected after receiving the response data from the server.

[0098] Step S206: In the process of re-establishing a new long connection, short connection polling is started to maintain the communication status with the server until a valid long connection is re-established.

[0099] In this embodiment, after disconnecting the long connection with the server and before establishing a new long connection between the electronic device and the server, the electronic device may establish a short connection with the server and maintain the communication status with the server through short connection polling until the electronic device re-establishes a valid long connection with the server.

[0100] In one of the embodiments, after the electronic device re-establishes a valid long connection with the server, the short connection polling with the server is stopped, and the electronic device uses the long connection to maintain the communication status with the server.

[0101] Step S208, while maintaining the communication state, if the user account belonging to the second application is bound to the device account belonging to the first application, then receive the operation result obtained by the operation on the device account triggered by the user account fed back by the server.

[0102] The operation result is the result obtained by the user account operating the device account, for example, the scanning information obtained after the user account scans the device account, the binding information obtained after the user account is bound to the device account, etc., but is not limited to this.

[0103] The first application runs on the electronic device, and the device account is an account belonging to the first application. The second application runs on the user device, and the user account is an account belonging to the second application.

[0104] In one embodiment, the device account belonging to the first application may be a device identifier of the electronic device. The user account of the second application is bound to the device account belonging to the first application, which may indicate that the user account of the second application is bound to the electronic device where the first application is located.

[0105] The user can log in to the second application running on the electronic device through the user account, and operate the device account of the first application through the user account of the second application to generate an operation result, and the second application sends the operation result to the server.

[0106] During the process of maintaining communication between the first application of the electronic device and the server, the first application can obtain from the server the operation result obtained by the user account performing an operation on the device account of the first application.

[0107] Step S210: updating the device status of the electronic device based on the operation result.

[0108] The device state refers to the current state of the electronic device, including but not limited to a pending binding state, a bound state, a pending session creation state, and a pending session joining state.

[0109] In this embodiment, after the first application of the electronic device obtains the operation result obtained by the user account operating the device account of the first application from the server, the device state of the electronic device is updated according to the operation result.

[0110] The above-mentioned device status update method establishes a long connection between the locally running first application and the server, and maintains the communication status with the server through the long connection, so that the communication between the first application and the server can be maintained for a long time, so that there is no need to re-establish communication with the server when sending and receiving data, thereby improving the efficiency of data sending and receiving, and reducing the background load.

[0111] If the long connection is in an invalid state, the long connection is disconnected and a new long connection is re-established. In the process of re-establishing the new long connection, short connection polling is started to maintain the communication status with the server until a valid long connection is re-established, so as to ensure that when the long connection fails, normal communication with the server can be maintained through the short connection to avoid data transmission and reception being affected. Whether in the process of maintaining the communication status through a long connection or a short connection, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account and fed back by the server is received, so that the device status of the electronic device can be updated timely and accurately based on the operation result.

[0112] In one embodiment, establishing a persistent connection between a locally running first application and a server, and maintaining a communication state with the server through the persistent connection includes:

[0113] A long connection establishment request is initiated to the server through the first application running locally to establish a long connection with the server; key information returned by the server based on the established long connection is received; a confirmation result is generated based on the key information, and the confirmation result is sent to the server to maintain the communication status with the server.

[0114] In one embodiment, after the first application running locally is started, the first application sends a persistent connection establishment request to the server using a private protocol to establish a persistent connection with the server. The private protocol refers to a specific protocol used to establish a persistent connection between the first application and the server.

[0115] Furthermore, after receiving the persistent connection establishment request sent by the electronic device through the first application using the private protocol, the server accepts the persistent connection establishment request between the first application of the electronic device.

[0116] Furthermore, after the long connection between the electronic device and the server is established, the server needs to negotiate the key information of the data transmission with the first application of the electronic device to ensure the secure transmission of the data. The server returns the key information to the first application of the electronic device through the long connection, and the first application of the electronic device receives the key information and confirms the key information to generate a confirmation result of the key information. The electronic device returns the confirmation result to the server through the long connection to maintain a secure communication state with the server.

[0117] In one embodiment, the electronic device negotiates key information for data transmission with the server through an RSA algorithm.

[0118] In this embodiment, a long connection establishment request is initiated to the server through the first application running locally to establish a long connection with the server, and the communication state between the electronic device and the server can be maintained for a long time through the long connection. The key information returned by the server based on the established long connection is received, a confirmation result is generated based on the key information, and the confirmation result is sent to the server. The security of data transmission can be guaranteed by negotiating the key information, thereby ensuring a secure communication state between the electronic device and the server.

[0119] In one embodiment, after establishing a long connection between a locally running first application and a server, the method also includes a step of determining whether the long connection is in an invalid state through a heartbeat packet, and the step specifically includes: sending a heartbeat packet to the server through the long connection every first preset time period; if the heartbeat packet is not successfully sent to the server, it is determined that the long connection is in an invalid state; if the heartbeat packet is successfully sent to the server, but no response packet is received from the server for the heartbeat packet within a first time period, it is determined that the long connection is in an invalid state.

[0120] The heartbeat packet, i.e., the keep alive packet, refers to a self-defined command word that the first application and the server periodically notify each other of their own status, and is sent at a certain time interval, similar to a heartbeat, so it is called a heartbeat packet. The heartbeat packet is a lightweight data packet.

[0121] In this embodiment, the electronic device predefines a heartbeat packet for detecting whether the long connection is valid. At intervals of a first preset duration, the first application of the electronic device sends a heartbeat packet to the server through the long connection. The electronic device detects whether the heartbeat packet can be successfully sent to the server. If the heartbeat packet cannot be successfully sent to the server, it can be determined that the long connection with the server is in an invalid state. If the heartbeat packet can be successfully sent to the server, it can be determined that the long connection with the server is in a valid state.

[0122] Alternatively, the electronic device detects whether the heartbeat packet can be successfully sent to the server. If the heartbeat packet can be successfully sent to the server, it detects whether a response packet for the heartbeat packet returned by the server through the long connection can be received within the first time period. If a response packet for the heartbeat packet returned by the server through the long connection is not received within the first time period, it can be determined that the long connection with the server is in an invalid state. If the heartbeat packet can be successfully sent to the server, and a response packet for the heartbeat packet returned by the server through the long connection can be received within the first time period, it can be determined that the long connection with the server is in a valid state.

[0123] The first preset duration can be set to 30 seconds, 40 seconds or 60 seconds, etc., but is not limited thereto and can be set according to needs.

[0124] In one embodiment, timing starts from the establishment of a long connection between the first application and the server, and a heartbeat packet is sent to the server through the long connection at intervals of a first preset time.

[0125] In this embodiment, a heartbeat packet is sent to the server via a long connection at intervals of a first preset time, and it is possible to determine whether the long connection between the first application and the server is in an invalid state by whether the heartbeat packet is successfully sent to the server, so that the communication state of the long connection can be detected at intervals of a preset time to ensure that the first application and the server can communicate normally. Alternatively, after the heartbeat packet is successfully sent to the server, whether a response packet returned by the server for the heartbeat packet can be received within a first time period, it is further determined whether the long connection between the first application and the server is in an invalid state. In the case of failing to successfully receive the response packet from the server, it is determined that the long connection between the first application and the server is in an invalid state, so that it is possible to more accurately determine whether the long connection is valid, thereby ensuring normal data transmission and reception.

[0126] In one embodiment, the method also includes a step of determining whether the long connection is in an invalid state through a preset request, and the step specifically includes: sending a preset request to the server through the long connection every second preset time; the second preset time is greater than the first preset time; if the preset request is not successfully sent to the server, it is determined that the long connection is in an invalid state; if the preset request is successfully sent to the server, but no response information returned by the server for the preset request is received within a second time period, it is determined that the long connection is in an invalid state.

[0127] In this embodiment, the electronic device predefines a preset request for detecting whether the long connection is valid. At intervals of a second preset time, the first application of the electronic device sends a preset request to the server through the long connection. The electronic device detects whether the preset request can be successfully sent to the server. If the preset request cannot be successfully sent to the server, it can be determined that the long connection with the server is in an invalid state. If the preset request can be successfully sent to the server, it can be determined that the long connection with the server is in a valid state.

[0128] Alternatively, the electronic device detects whether the preset request can be successfully sent to the server. If the preset request can be successfully sent to the server, it detects whether the response information for the preset request returned by the server through the long connection can be received within the second time period. If the response information returned by the server through the long connection for the preset request is not received within the second time period, it can be determined that the long connection with the server is in an invalid state. If the preset request can be successfully sent to the server, and the response information for the preset request returned by the server through the long connection can be received within the second time period, it can be determined that the long connection with the server is in a valid state.

[0129] The second preset duration can be set to 10 minutes or 15 minutes, etc., but is not limited thereto and can be set according to needs.

[0130] In one embodiment, the timing starts from the establishment of the persistent connection between the first application and the server, and a preset request is sent to the server through the persistent connection at intervals of a second preset time.

[0131] In this embodiment, the heartbeat packet data belongs to a lightweight data packet, and success may occur even in a poor network situation, but a normal request cannot be sent and a response letter cannot be received in a poor network situation. At each interval of the first preset duration, a heartbeat packet is used to detect whether the long connection is valid, so as to notify the server that the first application still has data online. At each interval of the second preset duration, a preset request is sent to detect whether the long connection is valid, so as to further detect whether the sending and receiving of normal-level data is normal.

[0132] In one embodiment, after establishing a long connection between a locally running first application and a server, the method also includes a step of determining whether the long connection is valid, which step specifically includes: sending a heartbeat packet to the server via the long connection every first preset time period; if the heartbeat packet is not successfully sent to the server, determining that the long connection is in an invalid state; if the heartbeat packet is successfully sent to the server, sending a preset request to the server via the long connection, if the preset request is successfully sent to the server, but no response information returned by the server for the preset request is received within a second time period, determining that the long connection is in an invalid state.

[0133] In this embodiment, a lightweight heartbeat packet is sent to the server through a long connection to notify the server that the first application is online. When the heartbeat packet can be successfully sent to the server, a preset request is sent to the server through a long connection, and whether the long connection can normally receive data is determined based on whether the response information for the preset request returned by the server through the long connection can be received, so as to accurately determine whether the long connection is in an invalid state.

[0134] In one embodiment, in the process of re-establishing a new long connection, starting short connection polling to maintain the communication state with the server until a valid long connection is re-established includes:

[0135] In the process of re-establishing a new long connection, a short connection is established between the first application and the server; a status query request is sent to the server through short connection polling until a valid long connection is re-established, and then the short connection polling is stopped; wherein each status query request sent is used for the electronic device to actively obtain the latest operation result, so as to update the device status of the electronic device in real time.

[0136] In this embodiment, when the long connection between the first application of the electronic device and the server is in an invalid state, the long connection is disconnected and a new long connection between the first application and the server is re-established. In the process of re-establishing a new long connection between the first application and the server, the electronic device can establish a short connection between the first application and the server, and send a status query request to the server through the short connection to actively obtain the latest operation results of the first application of the electronic device, and update the device status of the electronic device in real time according to the operation results. After completing a short connection process, the electronic device re-establishes a short connection with the server after a preset interval, returns to the step of sending a status query request to the server through the short connection and continues to execute until a valid long connection is re-established, and then stops the short connection polling.

[0137] In this embodiment, in the process of re-establishing a new long connection, a short connection is established between the first application and the server, and a status query request is sent to the server through short connection polling to actively obtain the latest operation results and update the device status of the electronic device in real time until a valid long connection is re-established, and then the short connection polling is stopped. When the long connection is unavailable, the communication status with the server can be maintained through short connection polling, so that the device status of the electronic device can be detected through a combination of long connection and short connection. The long connection can not only improve the real-time performance of data transmission and reception and reduce the background load, but also achieve the stability of the communication status through short connection polling, so that the communication between the electronic device and the server remains in the optimal state.

[0138] In one embodiment, in the process of maintaining the communication state, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account fed back by the server includes:

[0139] In the process of maintaining the communication status through a long connection, if the user account belonging to the second application is bound to the device account belonging to the first application, then the operation result obtained by the operation on the device account triggered by the user account and actively returned by the receiving server through the long connection.

[0140] In this embodiment, after a long connection is established between the first application of the electronic device and the server, when the device state of the electronic device changes, the server can actively push the device state information to the first application through the long connection so that the electronic device can update the current device state of the first application.

[0141] In one embodiment, a user logs in to a second application running on a user device through a user account, and the second application communicates with a server. After the user account of the second application is bound to the device account of the first application, the user account can be used to perform relevant operations on the device account to generate operation results. The second application cannot directly send the operation results to the first application, so the first application does not know the operations performed by the second application on itself, that is, the user account cannot directly return the operation results obtained by operating the device to the device account.

[0142] The user account of the second application sends the operation result to the server, and the server receives the operation result. While the first application and the server maintain communication through a persistent connection, the server actively feeds back the operation result to the device account of the first application through the persistent connection. The device account of the first application receives the operation result fed back by the server and updates the current device status according to the operation result.

[0143] For example, a user account binds the device account of the first application on the second application, and the current status of the user account is updated after the binding is completed. However, for the device account of the second application, the device account does not know that it has been bound to the user account. After the user account is bound to the device account, a binding information of successful binding is generated and sent to the server. When the device account and the server maintain a communication state through a long connection, the server sends the binding information to the device account. The device account learns that it has been bound to the user account based on the binding information, and then updates the current device status from the unbound state to the bound state. After binding, the various operations performed by the user device on the device account will still be returned to the device account by the server.

[0144] In this embodiment, in the process of maintaining the communication status through a long connection, if the user account belonging to the second application is bound to the device account belonging to the first application, the server will actively return the operation results obtained by the operation on the device account triggered by the user account through the long connection, so that the device account of the first application can promptly obtain the current device status from the server, thereby realizing real-time update of the device status.

[0145] like Figure 3 FIG. 1 is a timing diagram for establishing a long connection in one embodiment.

[0146] The first application running on the electronic device initiates a persistent connection establishment request to the server to establish a persistent connection with the server.

[0147] The server returns key information to the first application based on the established long connection, so as to negotiate a security key with the first application to ensure secure transmission of data.

[0148] The first application generates a confirmation result based on the key information, and sends the confirmation result to the server to complete the key negotiation with the server.

[0149] The second application can perform a binding operation on the first application to bind the first application. The second application generates binding information based on the binding operation and sends the binding information to the server.

[0150] The server receives the binding information, and feeds the binding information back to the first application through the persistent connection between the server and the first application.

[0151] The first application receives the binding information, and refreshes the current device state based on the binding information to update the first application from an unbound state to a bound state.

[0152] After the second application is bound to the first application, it can operate the first application, generate operation results based on the operations performed, and send the operation results to the server.

[0153] The server feeds back the operation result to the first application through a persistent connection, and the first application refreshes the current device status based on the operation result.

[0154] In one embodiment, in the process of maintaining the communication state, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account fed back by the server includes:

[0155] In each polling that maintains the communication status through short connection polling, a status query request is sent to the server. If the user account belonging to the second application is bound to the device account belonging to the first application, a response result to the status query request returned by the server through the short connection is received; the response result includes the operation result obtained by the operation on the device account triggered by the user account.

[0156] In this embodiment, after the short connection between the first application of the electronic device and the server is established, when other applications operate the first application so that the device state of the first application changes, the server can obtain the changed device state information from the other applications. When the first application establishes a short connection with the server and sends a state query request to the server through the short connection, the server feeds back the device state information to the first application through the short connection, so that the electronic device updates the current device state of the first application.

[0157] The user logs in to the second application running on the user's device through the user account, and the second application communicates with the server. After the user account of the second application is bound to the device account of the first application, the user account can be used to perform relevant operations on the device account to generate operation results. The second application cannot directly send the operation results to the first application, so the first application does not know the operation performed by the second application on itself, that is, the user account cannot directly return the operation results obtained by operating the device to the device account.

[0158] The user account of the second application sends the operation result to the server, and the server receives the operation result. While the first application and the server maintain communication through a short connection, the device account periodically sends a status query request to the server to obtain the current device status. After the device account sends a status query request to the server, the server returns a response result to the status query request through a short connection, and the response result includes the operation information, thereby feeding back the operation result to the device account of the first application through the short connection. The device account of the first application receives the operation result fed back by the server and updates the current device status according to the operation result.

[0159] In one embodiment, after the device account sends a status query request to the server, the server takes the operation result as a response result and returns it to the device account of the first application through a short connection.

[0160] For example, a user account binds a device account of a first application on a second application, and after the binding is completed, the current status of the user account is updated. However, for the device account of the second application, the device account does not know that it has been bound to the user account. When the device account and the server maintain communication status through short connection polling, the device account will periodically send status query requests to the server to obtain the latest device status from the server.

[0161] After the user account is bound to the device account, a binding information indicating successful binding is generated and sent to the server. When the device account sends a status query request to the server through a short connection, the server receives the status query request and sends the binding information to the device account as a response result. The device account learns that it has been bound to the user account based on the binding information, and updates the current device status from the unbound state to the bound state. After binding, the server will still return the operation results to the device account for various operations performed by the user device on the device account.

[0162] In this embodiment, in each polling for maintaining the communication status through short connection polling, a status query request is sent to the server. If the user account belonging to the second application is bound to the device account belonging to the first application, a response result to the status query request returned by the server through the short connection is received. The response result includes the operation result obtained by the operation on the device account triggered by the user account, so that the device account of the first application can obtain the current device status from the server through the short connection, thereby realizing real-time update of the device status.

[0163] like Figure 4 FIG. 1 is a timing diagram for establishing a short connection in one embodiment.

[0164] The first application running on the electronic device initiates a short connection establishment request to the server to establish a short connection with the server.

[0165] The first application sends a status query request to the server based on the established short connection, and the server returns the current device status of the first application based on the status query request.

[0166] After receiving the device status, the first application disconnects the short connection with the server and refreshes the current device status based on the received device status.

[0167] The second application can perform a binding operation on the first application to bind the first application. The second application generates binding information based on the binding operation and sends the binding information to the server.

[0168] The server receives the binding information and waits for a status query request sent by the first application.

[0169] After the first application refreshes the current device status, it delays for d seconds and establishes a short connection with the server again. When the first application establishes a short connection with the server and sends a status query request to the server through the short connection, the server responds to the status query request and feeds back the binding information to the first application through the short connection between the first application and the server.

[0170] After receiving the binding information, the first application disconnects the short connection with the server and refreshes the current device state based on the received device state to update the first application from an unbound state to a bound state.

[0171] After the second application is bound to the first application, it can operate the first application, generate operation results based on the operations performed, and send the operation results to the server.

[0172] The server feeds back the operation result to the first application through a persistent connection, and the first application refreshes the current device status based on the operation result.

[0173] In one embodiment, Figure 5 As shown, the device state of the electronic device is represented by the current display content of the electronic device; in the process of maintaining the communication state, if the user account belonging to the second application is bound to the device account belonging to the first application, then the operation result obtained by the operation on the device account triggered by the user account and fed back by the server is received, including steps S502 to S504, wherein:

[0174] Step S502: while maintaining the communication state, displaying a binding graphic code for binding with a device account belonging to the first application.

[0175] Among them, graphic code refers to a graphic identifier that uses different graphics arranged according to certain coding rules to express data information. Graphic codes can specifically include QR codes and bar codes, but are not limited to them. QR code, also known as two-dimensional bar code, is a black and white graphic that records data symbol information distributed in a plane (two-dimensional direction) according to a certain pattern using certain geometric figures. Barcode is a graphic identifier that arranges multiple black bars and blanks of varying widths according to certain coding rules to express a group of information.

[0176] The device state of an electronic device refers to the device state of a first application displayed by the electronic device, which can be represented by the current display content of the first application running on the electronic device. The current display content can be a displayed graphic code or other display information. After starting the first application on the electronic device, the first application is logged in through the device account, so that a graphic code for binding with the device account, i.e., a binding graphic code, is displayed on the first application. The binding image QR code indicates that the first application is not bound.

[0177] In one embodiment, after the first application is started, the electronic device can establish a long connection or a short connection between the first application and the server, and maintain the communication status with the server through long connection or short connection polling. After the long connection or the short connection is established, the first application still displays the binding graphic code for binding with the device account.

[0178] Step S504: After the user account belonging to the second application scans the binding graphic code, the server returns the binding information indicating that the user account has been bound to the device account.

[0179] In this embodiment, after the user logs in to the second application running on the user device through the user account, the second application can scan the binding graphic code displayed on the first application to bind the device account of the first application with the user account of the second application. After the user device binds the user account and the device account, it generates binding information and sends the binding information to the server.

[0180] The server receives the binding information and returns the binding information to the device account of the first application. The device account of the first application receives the binding information of the user account and the device account bound to it returned by the server.

[0181] Updating the device state of the electronic device based on the operation result includes step S506, wherein:

[0182] Step S506: updating the binding graphic code to a session graphic code based on the binding information and displaying the code; the session graphic code is used to create a session or join an already created session.

[0183] The first application receives the binding information fed back by the server, updates the currently displayed binding graphic code to a session graphic code, and displays the session graphic code on the current interface. Different session graphic codes have different functions, such as being used to create a session or to join an already created session.

[0184] In this embodiment, in the process of maintaining the communication state, a binding graphic code for binding with the device account belonging to the first application is displayed to indicate that the first application is currently in an unbound state. After the user account belonging to the second application scans the binding graphic code, the binding information of the user account bound to the device account returned by the receiving server is accurately updated to a session graphic code based on the binding information, thereby timely updating the first application from an unbound state to a bound state, and displaying a session graphic code for creating a session or joining an already created session on the current interface, so that the second application can further operate the first application through the session graphic code, thereby realizing the second application's control over the first application.

[0185] In one embodiment, when a first application receives a session graphic code sent by another first application for joining an already created session, the session graphic code is displayed on the first application. If a user account belonging to a second application is bound to a device account belonging to the first application, the user account of the second application can scan the session graphic code to enter the already created session.

[0186] In one embodiment, in the process of maintaining the communication state, if the user account belonging to the second application is bound to the device account belonging to the first application, then receiving the operation result obtained by the operation on the device account triggered by the user account fed back by the server, further includes: after the user account is bound to the device account, receiving the session creation information sent by the server, which is obtained by the session creation operation triggered by the user account scanning the session graphic code and selecting the session member account. Updating the device state of the electronic device based on the operation result includes: in response to the session creation information, switching the currently displayed session graphic code to display content in the session state for display.

[0187] In this embodiment, the first application receives the binding information fed back by the server, updates the currently displayed binding graphic code to a session graphic code, and displays the session graphic code on the current interface, thereby updating the device state from the bound state to the state of a session to be created. The session graphic code is used to create a session. The user account of the second application can scan the session graphic code displayed on the device account of the first application to display a selection interface for session member accounts on the second application. After the user selects the session member account that needs to participate in the session on the selection interface of the second application, a session creation request is generated. The user account sends the session creation request to the server, and the server receives the session creation request and returns the session creation request to the device account of the first application.

[0188] The device account of the first application receives the session creation request, and in response to the session creation request, switches the currently displayed session graphic code to the display content under the session status, and displays the display content of the session status on the current interface, thereby updating the device status from the session to be created status to the session status to complete the creation of the session.

[0189] In this embodiment, after the user account is bound to the device account, the session creation information obtained by the session creation operation triggered by the user account scanning the session graphic code and selecting a session member account is received from the server, so that based on the session creation information returned by the server, the currently displayed session graphic code can be accurately and timely switched to the display content in the session state for display, thereby updating the device state from the state of session to be created to the session state, thereby ensuring the timeliness and accuracy of the device state update.

[0190] In one embodiment, in the process of maintaining the communication state through the persistent connection, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account and actively returned by the server through the persistent connection includes:

[0191] In the process of maintaining the communication status through a long connection, a binding graphic code for binding to a device account belonging to the first application is displayed; after the user account belonging to the second application scans the binding graphic code, the server actively returns the binding information that the user account has been bound to the device account; based on the binding information, the binding graphic code is updated to a session graphic code and displayed; the second application runs in the user device, and the session graphic code is used to create a session; after the user account is bound to the device account, the server actively returns the session creation information through the long connection, which is triggered by the user account scanning the session graphic code and selecting a session member account; in response to the session creation information, the currently displayed session graphic code is switched to the display content under the session state for display.

[0192] The device state of an electronic device refers to the device state of a first application displayed by the electronic device, which can be represented by the current display content of the first application running on the electronic device. The current display content can be a displayed graphic code or other display information. After starting the first application on the electronic device, the first application is logged in through the device account, so that a graphic code for binding with the device account, i.e., a binding graphic code, is displayed on the first application. The binding image QR code indicates that the first application is not bound.

[0193] After the first application is started, the electronic device can establish a persistent connection between the first application and the server, and maintain the communication state with the server through the persistent connection. After the persistent connection is established, the first application still displays the binding graphic code for binding with the device account.

[0194] After the user logs in to the second application running on the user device through the user account, the second application can scan the binding graphic code displayed on the first application to bind the device account of the first application with the user account of the second application. After the user device binds the user account and the device account, it generates binding information and sends the binding information to the server.

[0195] The server receives the binding information, and actively returns the binding information to the device account of the first application through a persistent connection. The device account of the first application receives the binding information actively returned by the server through the persistent connection.

[0196] The first application receives the binding information, updates the currently displayed binding graphic code to a session graphic code, and displays the session graphic code on the current interface, thereby updating the device state from a bound state to a session to be created state.

[0197] The session graphic code is used by the user account to manipulate the device account to create a session on the first application. The user account of the second application can scan the session graphic code displayed on the device account of the first application to display the selection interface of the session member account on the second application. After the user selects the session member account that needs to participate in the session on the selection interface of the second application, a session creation request is generated. The user account sends the session creation request to the server, and the server receives the session creation request and actively returns the session creation request to the device account of the first application through a long connection.

[0198] The device account of the first application receives the session creation request, and in response to the session creation request, switches the currently displayed session graphic code to the display content under the session status, and displays the display content of the session status on the current interface, thereby updating the device status from the session to be created status to the session status to complete the creation of the session.

[0199] In one embodiment, the device state of the electronic device is represented by the current display content of the electronic device; in each polling of maintaining the communication state through short connection polling, a status query request is sent to the server, and if the user account belonging to the second application is bound to the device account belonging to the first application, a response result returned by the server through the short connection for the status query request is received, including:

[0200] In the process of maintaining the communication status through short connection polling, a binding graphic code for binding to a device account belonging to the first application is displayed; after sending a status query request to the server through the short connection, if the user account belonging to the second application is bound to the device account by scanning the binding graphic code, the binding information of the user account bound to the device account returned by the server through the short connection is received; based on the binding information, the binding graphic code is updated to a session graphic code and displayed; the second application runs in the user device, and the session graphic code is used to create a session; after the user account is bound to the device account, the status query request is continued to be sent to the server, and the session creation information obtained by the session creation operation triggered by the user account scanning the session graphic code and selecting a session member account is received, which is returned by the server in response to the status query request; in response to the session creation information, the currently displayed session graphic code is switched to the display content under the session state for display.

[0201] After the first application is started on the electronic device, the first application is logged in through the device account, so that a graphic code for binding with the device account, namely a binding graphic code, is displayed on the first application. The binding graphic QR code indicates that the first application is not bound.

[0202] After the first application is started, the electronic device may establish a short connection between the first application and the server, and maintain a communication status with the server through short connection polling.

[0203] After the user logs in to the second application running on the user device through the user account, the second application can scan the binding graphic code displayed on the first application to bind the device account of the first application with the user account of the second application. After the user device binds the user account and the device account, it generates binding information and sends the binding information to the server.

[0204] The server receives the binding information and waits for a status query request sent by the device account of the first application. After the device account of the first application establishes a short connection with the server, it sends a status query request to the server through the short connection. The server receives the status query request and returns the binding information to the device account through the short connection. After receiving the binding information returned by the server through the short connection, the device account of the first application disconnects the short connection with the server. Based on the binding information, the currently displayed binding graphic code is updated to a session graphic code, and the session graphic code is displayed on the current interface, thereby updating the device status from the bound status to the session status to be created.

[0205] The session graphic code is used by the user account to manipulate the device account to create a session on the first application. The user account of the second application can scan the session graphic code displayed on the device account of the first application to display the selection interface of the session member account on the second application. After the user selects the session member account that needs to participate in the session on the selection interface of the second application, a session creation request is generated. The user account sends the session creation request to the server, and the server receives the session creation request and waits for the status query request sent by the device account of the first application. After the device account of the first application establishes a short connection with the server, it sends a status query request to the server through the short connection. The server receives the status query request and actively returns the session creation request to the device account of the first application through the short connection.

[0206] The device account of the first application receives the session creation request and disconnects the short connection with the server. In response to the session creation request, the device account switches the currently displayed session graphic code to the display content under the session state, and displays the display content of the session state on the current interface, thereby updating the device state from the state of the session to be created to the state of the session to complete the creation of the session.

[0207] In one embodiment, the first application includes a session management application, the electronic device includes a multimedia session device for providing session room resources, the second application includes an organization management application, and the second application provides session member accounts for participating in the session.

[0208] The first application includes a session management application, which runs on an electronic device. The electronic device includes a multimedia session device, which is used to provide session room resources to create a session through the session room resources, or to join an already created session. The second application includes an organization management application, which runs on a user device, and the second application provides a session member account for participating in the session, so that after the second application selects a session member account for participating in the session, it uses the session room resources on the session management application of the multimedia session device to create a session.

[0209] In this embodiment, the device status update method can be applied to the session scenario. The session management application communicates with the server through a long connection or a short connection, which can effectively solve the problem of heavy background load when only a short connection is used for communication. The organization management application can operate the session management application and send the operation result to the server. The server returns the operation result to the organization management application through a long connection or a short connection, so that the organization management application updates the current device status.

[0210] In one embodiment, the present application also provides an application scenario, such as Figures 6 to 10 As shown, the application scenario applies the above-mentioned device status update method. In this embodiment, the application of the device status update method in the application scenario is as follows:

[0211] The electronic device is a multimedia conversation device, the first application is a conversation management application installed on the multimedia conversation device, that is, a conference APP. The user device can be a mobile phone, and the second application can be WeChat for Business installed on the mobile phone.

[0212] WeChat for Business's audio and video conferences cover both online and offline scenarios. WeChat for Business provides a conference APP that can be installed on the multimedia session device in the offline conference room. After the conference APP is started on the multimedia session device, the conference APP sends a persistent connection establishment request to the server to establish a persistent connection with the server. The server returns key information to the conference APP based on the established persistent connection to negotiate a security key with the conference APP to ensure secure data transmission. The conference APP generates a confirmation result based on the key information and sends the confirmation result to the server to complete the key negotiation with the server.

[0213] The newly installed conference APP on the multimedia conversation device needs to be bound to the enterprise WeChat before it can be used. After successful binding, the conference APP has functions such as initiating meetings and receiving meeting invitations. If users want to control the conference APP in the meeting room, they need to use the enterprise WeChat on their mobile phone to scan the QR code of the conference APP to bind it with the conference APP. Figure 6 It is the QR code displayed by the conference APP for binding with the conference APP.

[0214] When users use WeChat for Business to scan their faces Figure 6 After clicking the QR code, WeChat Work will enter Figure 7 The device adding page shown in (a) in the figure. The device adding page displays the device account of the conference APP, such as Figure 7 The “AA video conferencing tablet” shown in (a) may also represent the device account of the multimedia session device where the conference APP is located.

[0215] The user can trigger the operation control bound to the device account, and WeChat for Business completes the binding with the device account based on the binding operation to enter the following Figure 7 The device is bound to the display interface shown in (b) of the figure. Figure 7 Click the "Finish" control in the display interface of the device bound as shown in (b) to enter the following Figure 7 The device management interface shown in (c) in the figure shows the bound conference APP. Update Figure 7 The device adding page shown in (a) in the figure is obtained. Figure 7 The updated device adding page shown in (d) in the figure displays a removal control for the conference APP and displays the administrator of the conference APP. The removal control is such as "Remove Device".

[0216] After the binding is successful, Enterprise WeChat generates binding information and sends the binding information to the server, and the server receives the binding information.

[0217] If the persistent connection between the server and the conference APP is valid at this time, the server will actively feed back the binding information to the conference APP through the persistent connection between the server and the conference APP.

[0218] If the long connection between the server and the conference APP fails at this time, the server waits for the conference APP to send a status query request. After the short connection is established between the conference APP and the server, the conference APP sends a status query request to the server, and the server returns the binding information to the conference APP based on the status query request.

[0219] The conference APP receives the binding information and enters Figure 8 The page shown is waiting for the user to initiate a meeting, and the session QR code for creating a meeting is displayed on the page.

[0220] Enterprise WeChat Scan Figure 8 After you enter the session QR code, Fig. 9The conference type selection page shown in (a) of FIG. 1 shows the conference type selection page. The user can select the conference type to be initiated on the conference type selection page, including voice conference or video conference. After selecting the conference type to be initiated, if you select video conference, you will enter the following Fig. 9 The selection interface shown in (b) of FIG. 10 can select participants and conference devices in the selection interface. Participants refer to members participating in the conference, and conference devices refer to multimedia session devices participating in the conference. The user triggers the operation control of the participant to enter the following example: Fig. 9 (c) of the conference, select the account of the member who will participate in the conference. After completing the selection of participants, return to Fig. 9 The selection interface shown in (b) of FIG. 1 is used to trigger the operation control of the conference device on the interface to enter the selection interface shown in FIG. Fig. 9 (d) shows a conference device selection interface, in which multimedia session devices participating in the conference are selected, such as "XX1 conference room device", "XX2 conference room device" and "XX3 conference room device". After the selection is completed, the user enters the following interface: Fig. 9 The conference initiation interface shown in (e) in FIG. The operation control for initiating a conference is triggered in the conference initiation interface to generate a conference initiation request. Enterprise WeChat sends the conference initiation request to the server, and the server receives the conference initiation request.

[0221] If the server and the conference APP maintain communication through a persistent connection at this time, the server will actively feedback the conference initiation request to the conference APP through the persistent connection, and the conference APP will Figure 8 The session QR code shown in the figure enters Fig.10 Conference mode shown.

[0222] If the long connection between the server and the conference APP fails at this time, the server waits for the conference APP to send a status query request. After the short connection is established between the conference APP and the server, the conference APP sends a status query request to the server. The server returns a conference initiation request to the conference APP based on the status query request. Then the conference APP Figure 8 The session QR code shown in the figure enters Fig.10 Conference mode shown.

[0223] In other embodiments, when a multimedia session device receives a QR code sent by another multimedia session device for joining a created session, the QR code is displayed through the conference APP running on the multimedia session device. The user can scan the QR code through WeChat for Enterprise, so that the conference APP enters the session. Fig.10 Conference mode shown.

[0224] In one embodiment, Fig.11 As shown, a device status update method is provided, which is applied to Figure 1The server in the example is used to illustrate the following steps:

[0225] Step S1102, establishing a persistent connection with a first application, and maintaining a communication state with the first application through the persistent connection, wherein the first application runs in the electronic device.

[0226] The first application runs on the electronic device. After the user logs in to the first application running on the electronic device through the device account, the first application initiates a persistent connection establishment request to the server. The server receives the persistent connection establishment request, establishes a persistent connection with the first application, and maintains the communication status between the electronic device and the server through the persistent connection.

[0227] Step S1104: If the persistent connection is in an invalid state, disconnecting the persistent connection is triggered and a new persistent connection is reestablished.

[0228] When the electronic device detects that the persistent connection with the server is in an invalid state, the persistent connection with the server is disconnected. After the persistent connection between the server and the first application is disconnected, the electronic device again initiates a persistent connection establishment request to the server through the first application. The server receives the persistent connection establishment request and attempts to re-establish a persistent connection with the first application.

[0229] Step S1106, in the process of re-establishing a new long connection, receiving a status query request sent by the first application in a short connection polling manner, so as to maintain the communication status with the first application through the status query request until a valid long connection is re-established.

[0230] After the long connection between the server and the first application is disconnected, and before a new long connection is established between the first application and the server, the first application of the electronic device can establish a short connection with the server, and the server maintains the communication status with the first application through short connection polling between the first application and the first application until a valid long connection is re-established between the first application and the server.

[0231] Furthermore, the first application of the electronic device can establish a short connection with the server, and the first application sends a status query request to the server in a short connection polling manner to maintain the communication status with the first application through the status query request until a valid long connection is re-established.

[0232] After re-establishing a valid long connection with the server, the short connection polling with the first application is stopped, and the long connection is reused to maintain the communication state with the first application.

[0233] Step S1108, while maintaining the communication status, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account is obtained through the second application, and the operation result is returned to the first application to which the device account belongs; the operation result is used to instruct the first application to update the device status of the electronic device.

[0234] The first application runs on the electronic device, and the device account belongs to the account of the first application. The second application runs on the user device, and the user account belongs to the account of the second application.

[0235] The user can operate the device account of the first application through the user account of the second application to generate an operation result, and send the operation result to the server. The server receives the operation result sent by the second application, and in the process of the first application of the electronic device and the server maintaining communication, the operation result can be returned to the first application to which the device account belongs, so that the first application updates the device status of the electronic device based on the operation result.

[0236] In this embodiment, the first application runs in the electronic device, establishes a long connection with the first application, and maintains the communication status with the first application through the long connection, so that the communication between the first application and the server can be maintained for a long time, so that there is no need to re-establish communication with the server when sending and receiving data, thereby improving the efficiency of data sending and receiving, and reducing the background load.

[0237] If the long connection fails, a new long connection is re-established. In the process of re-establishing the new long connection, the status query request sent by the first application in the form of short connection polling is received, so as to maintain the communication status with the first application through the status query request until a valid long connection is re-established. This can ensure that when the long connection fails, normal communication with the server can be maintained through the short connection to avoid data transmission and reception being affected. Whether in the process of maintaining the communication status through a long connection or a short connection, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account is obtained through the second application, and the operation result is returned to the first application to which the device account belongs, so as to instruct the electronic device to update its own device status timely and accurately based on the operation result.

[0238] In one embodiment, in the process of maintaining the communication state, if the user account belonging to the second application is bound to the device account belonging to the first application, obtaining the operation result obtained by the operation on the device account triggered by the user account through the second application, and returning the operation result to the first application to which the device account belongs, includes:

[0239] In the process of maintaining the communication status through a long connection, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation triggered by the user account on the device account is obtained, and the operation result is actively returned to the device account; in the process of maintaining the communication status through short connection polling, if the user account is bound to the device account, the operation result obtained by the operation triggered by the user account on the device account is obtained; after receiving the status query request sent by the device account, the operation result is returned based on the status query request.

[0240] In one embodiment, a method for updating a device status is provided, comprising:

[0241] The electronic device initiates a persistent connection establishment request to the server through the first application running locally, and the server accepts the persistent connection request to establish a persistent connection with the first application.

[0242] The server returns key information for securely transmitting data to the first application based on the established long connection.

[0243] The electronic device generates a confirmation result based on the key information and sends the confirmation result to the server.

[0244] Every first preset time interval, the electronic device sends a heartbeat packet to the server through a long connection. If the heartbeat packet cannot be successfully sent to the server, it is determined that the long connection is in an invalid state; if the heartbeat packet is successfully sent to the server, but no response packet is received from the server for the heartbeat packet within the first time period, it is determined that the long connection is in an invalid state.

[0245] At intervals of a second preset time period, the electronic device sends a preset request to the server through a long connection, and the second preset time period is greater than the first preset time period; if the preset request is not successfully sent to the server, it is determined that the long connection is in an invalid state; if the preset request is successfully sent to the server, but no response information returned by the server for the preset request is received within the second time period, it is determined that the long connection is in an invalid state.

[0246] If the long connection is in an invalid state, the electronic device disconnects the long connection and re-establishes a new long connection.

[0247] In the process of re-establishing a new long connection, the electronic device establishes a short connection between the first application and the server, and sends a status query request to the server through short connection polling until a valid long connection is re-established, and then stops short connection polling; wherein each status query request sent is used for the electronic device to obtain the latest operation result from the server, so as to update the device status of the electronic device in real time.

[0248] In the process of maintaining the communication state through the long connection, the electronic device displays a binding graphic code for binding with a device account belonging to the first application through the first application.

[0249] After the user account belonging to the second application scans the binding graphic code, the user account sends the generated binding information to the server, and the server actively returns the binding information to the device account through a long connection.

[0250] The electronic device updates the binding graphic code to a session graphic code based on the binding information and displays the code; the second application runs in the user device, and the session graphic code is used to create a session.

[0251] After the user account belonging to the second application scans the session graphic code, session creation information is generated, and the user account sends the generated session creation information to the server. The server actively returns the session creation information to the device account through a long connection.

[0252] The electronic device receives the session creation information actively returned by the server through the long connection, and in response to the session creation information, switches the session graphic code currently displayed by the first application to the display content in the session state for display, so as to complete the creation of the session.

[0253] In the process of maintaining the communication state through short connection polling, the electronic device displays a binding graphic code for binding with a device account belonging to the first application through the first application.

[0254] After the user account belonging to the second application scans the binding graphic code, the user account generates binding information, and the user account sends the generated binding information to the server, and the server receives the binding information.

[0255] When the server receives the status query request sent by the device account through the short connection, it feeds back the binding information to the user account through the short connection. After receiving the binding information, the user account disconnects the short connection with the server.

[0256] The user account updates the binding graphic code to the session graphic code based on the binding information and displays it on the current interface.

[0257] After the user account belonging to the second application scans the session graphic code, session creation information is generated, the user account sends the generated session creation information to the server, and the server receives the session creation information.

[0258] After the device account reestablishes a short connection with the server and sends a status query request to the server through the short connection, the server feeds back the session creation information to the user account through the short connection. After receiving the session creation information, the user account disconnects the short connection with the server.

[0259] In response to the session creation information, the device account switches the session graphic code currently displayed in the first application to the display content in the session state to enter the conference state.

[0260] In this embodiment, a long connection is established between the locally running first application and the server, and the communication status with the server is maintained through the long connection, so that the communication between the first application and the server can be maintained for a long time, thereby eliminating the need to re-establish communication with the server when sending and receiving data, thereby improving the efficiency of data sending and receiving, and reducing the background load.

[0261] The receiving server returns the key information based on the established long connection, generates a confirmation result based on the key information, and sends the confirmation result to the server. By negotiating the key information, the security of data transmission can be guaranteed, thereby ensuring a secure communication status between the electronic device and the server.

[0262] By sending heartbeat packets and preset requests to the server through a long connection, whether the heartbeat packets and the preset requests can be successfully sent and whether the server's response can be received are used as conditions for judging whether the long connection is invalid. The current communication status can be accurately grasped, so that when the long connection fails, other methods can be used to ensure normal communication between the first application and the server to avoid affecting data transmission and reception.

[0263] If the long connection is in an invalid state, the long connection is disconnected and a new long connection is re-established. During the process of re-establishing the new long connection, short connection polling is started to maintain the communication status with the server until a valid long connection is re-established to ensure that when the long connection fails, normal communication with the server can be maintained through the short connection to avoid affecting data transmission and reception.

[0264] Whether maintaining the communication status through a long connection or a short connection, if the user account belonging to the second application is bound to the device account belonging to the first application, the binding information obtained by the operation on the device account triggered by the user account and fed back by the server is received, and the binding graphic code is accurately updated to the session graphic code based on the binding information, so that the first application is updated from an unbound state to a bound state in a timely manner, and the session graphic code for creating a session is displayed on the current interface, so that the second application can further operate the first application through the session graphic code, thereby realizing the second application's control over the first application.

[0265] After the user account is bound to the device account, the session creation information obtained by the session creation operation triggered by the user account scanning the session graphic code and selecting a session member account is received from the server, so that based on the session creation information returned by the server, the currently displayed session graphic code can be accurately and timely switched to the display content under the session state for display, thereby updating the device state from the state of session to be created to the session state, ensuring the timeliness and accuracy of the device state update.

[0266] It should be understood that although Figure 2-Figure 11 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-Figure 11 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0267] In one embodiment, Fig.12 As shown, a device status updating device 1200 is provided. The device 1200 can be a part of an electronic device using a software module or a hardware module, or a combination of the two. The device specifically includes: an establishment module 1202, a reconstruction module 1204, a polling module 1206, a receiving module 1208 and an updating module 1210, wherein:

[0268] Establishing module 1202 is used to establish a persistent connection between the first application running locally and the server, and maintain the communication status with the server through the persistent connection.

[0269] The reconstruction module 1204 is used to disconnect the persistent connection and re-establish a new persistent connection if the persistent connection is in an invalid state.

[0270] The polling module 1206 is used to start short connection polling to maintain the communication status with the server during the process of re-establishing a new long connection until a valid long connection is re-established.

[0271] The receiving module 1208 is used to receive the operation result obtained by the operation on the device account triggered by the user account fed back by the server if the user account belonging to the second application is bound to the device account belonging to the first application during the communication state.

[0272] The updating module 1210 is used to update the device status of the electronic device based on the operation result.

[0273] In this embodiment, a long connection is established between the locally running first application and the server, and the communication status with the server is maintained through the long connection, so that the communication between the first application and the server can be maintained for a long time, thereby eliminating the need to re-establish communication with the server when sending and receiving data, thereby improving the efficiency of data sending and receiving, and reducing the background load.

[0274] If the long connection is in an invalid state, the long connection is disconnected and a new long connection is re-established. In the process of re-establishing the new long connection, short connection polling is started to maintain the communication status with the server until a valid long connection is re-established, so as to ensure that when the long connection fails, normal communication with the server can be maintained through the short connection to avoid data transmission and reception being affected. Whether in the process of maintaining the communication status through a long connection or a short connection, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account and fed back by the server is received, so that the device status of the electronic device can be updated timely and accurately based on the operation result.

[0275] In one embodiment, module 1202 is established to initiate a long connection establishment request to the server through a first application running locally to establish a long connection with the server; receive key information returned by the server based on the established long connection; generate a confirmation result based on the key information, and send the confirmation result to the server to maintain the communication status with the server.

[0276] In this embodiment, a long connection establishment request is initiated to the server through the first application running locally to establish a long connection with the server, and the communication state between the electronic device and the server can be maintained for a long time through the long connection. The key information returned by the server based on the established long connection is received, a confirmation result is generated based on the key information, and the confirmation result is sent to the server. The security of data transmission can be guaranteed by negotiating the key information, thereby ensuring a secure communication state between the electronic device and the server.

[0277] In one embodiment, the device also includes a detection module; the detection module is used to send a heartbeat packet to the server through a long connection every first preset time period; if the heartbeat packet is not successfully sent to the server, it is determined that the long connection is in an invalid state; if the heartbeat packet is successfully sent to the server, but no response packet is received from the server for the heartbeat packet within a first time period, it is determined that the long connection is in an invalid state.

[0278] In this embodiment, a heartbeat packet is sent to the server via a long connection at intervals of a first preset time, and it is possible to determine whether the long connection between the first application and the server is in an invalid state by whether the heartbeat packet is successfully sent to the server, so that the communication state of the long connection can be detected at intervals of a preset time to ensure that the first application and the server can communicate normally. Alternatively, after the heartbeat packet is successfully sent to the server, whether a response packet returned by the server for the heartbeat packet can be received within a first time period, it is further determined whether the long connection between the first application and the server is in an invalid state. In the case of failing to successfully receive the response packet from the server, it is determined that the long connection between the first application and the server is in an invalid state, so that it is possible to more accurately determine whether the long connection is valid, thereby ensuring normal data transmission and reception.

[0279] In one embodiment, the detection module is also used to send a preset request to the server through a long connection every second preset time period; the second preset time period is greater than the first preset time period; if the preset request is not successfully sent to the server, it is determined that the long connection is in an invalid state; if the preset request is successfully sent to the server, but no response information returned by the server for the preset request is received within a second time period, it is determined that the long connection is in an invalid state.

[0280] In this embodiment, the heartbeat packet data belongs to a lightweight data packet, and success may occur even in a poor network situation, but a normal request cannot be sent and a response letter cannot be received in a poor network situation. At each interval of the first preset duration, a heartbeat packet is used to detect whether the long connection is valid, so as to notify the server that the first application still has data online. At each interval of the second preset duration, a preset request is sent to detect whether the long connection is valid, so as to further detect whether the sending and receiving of normal-level data is normal.

[0281] In one embodiment, the polling module 1206 is also used to establish a short connection between the first application and the server during the process of re-establishing a new long connection; send a status query request to the server through short connection polling until a valid long connection is re-established, and then stop short connection polling; wherein each status query request sent is used for the electronic device to actively obtain the latest operation result, so as to update the device status of the electronic device in real time.

[0282] In this embodiment, in the process of re-establishing a new long connection, a short connection is established between the first application and the server, and a status query request is sent to the server through short connection polling to actively obtain the latest operation results and update the device status of the electronic device in real time until a valid long connection is re-established, and then the short connection polling is stopped. When the long connection is unavailable, the communication status with the server can be maintained through short connection polling, so that the device status of the electronic device can be detected through a combination of long connection and short connection. The long connection can not only improve the real-time performance of data transmission and reception and reduce the background load, but also achieve the stability of the communication status through short connection polling, so that the communication between the electronic device and the server remains in the optimal state.

[0283] In one embodiment, the receiving module 1208 is also used to, in the process of maintaining the communication status through a long connection, if the user account belonging to the second application is bound to the device account belonging to the first application, then the operation result obtained by the operation on the device account triggered by the user account and actively returned by the server through the long connection.

[0284] In this embodiment, in the process of maintaining the communication status through a long connection, if the user account belonging to the second application is bound to the device account belonging to the first application, the server will actively return the operation results obtained by the operation on the device account triggered by the user account through the long connection, so that the device account of the first application can promptly obtain the current device status from the server, thereby realizing real-time update of the device status.

[0285] In one embodiment, the receiving module 1208 is also used to send a status query request to the server in each polling to maintain the communication status through short connection polling. If the user account belonging to the second application is bound to the device account belonging to the first application, the response result of the status query request returned by the server through the short connection is received; the response result includes the operation result obtained by the operation on the device account triggered by the user account.

[0286] In this embodiment, in each polling for maintaining the communication status through short connection polling, a status query request is sent to the server. If the user account belonging to the second application is bound to the device account belonging to the first application, a response result to the status query request returned by the server through the short connection is received. The response result includes the operation result obtained by the operation on the device account triggered by the user account, so that the device account of the first application can obtain the current device status from the server through the short connection, thereby realizing real-time update of the device status.

[0287] In one embodiment, the receiving module 1208 is also used to display a binding graphic code for binding to a device account belonging to the first application while maintaining the communication status; after the user account belonging to the second application scans the binding graphic code, the receiving server returns the binding information of the user account bound to the device account; the updating module is also used to update the binding graphic code to a session graphic code based on the binding information and display it; the session graphic code is used to create a session or join an already created session.

[0288] In this embodiment, in the process of maintaining the communication state, a binding graphic code for binding with the device account belonging to the first application is displayed to indicate that the first application is currently in an unbound state. After the user account belonging to the second application scans the binding graphic code, the binding information of the user account bound to the device account returned by the receiving server is accurately updated to a session graphic code based on the binding information, thereby timely updating the first application from an unbound state to a bound state, and displaying a session graphic code for creating a session or joining an already created session on the current interface, so that the second application can further operate the first application through the session graphic code, thereby realizing the second application's control over the first application.

[0289] In one embodiment, the receiving module 1208 is further used to receive, after the user account is bound to the device account, session creation information sent by the server, which is obtained by a session creation operation triggered by the user account scanning the session graphic code and selecting a session member account; the updating module is further used to switch the currently displayed session graphic code to display content in the session state in response to the session creation information.

[0290] In this embodiment, after the user account is bound to the device account, the session creation information obtained by the session creation operation triggered by the user account scanning the session graphic code and selecting a session member account is received from the server, so that based on the session creation information returned by the server, the currently displayed session graphic code can be accurately and timely switched to the display content in the session state for display, thereby updating the device state from the state of session to be created to the session state, thereby ensuring the timeliness and accuracy of the device state update.

[0291] In one embodiment, the first application includes a session management application, the electronic device includes a multimedia session device for providing session room resources, the second application includes an organization management application, and the second application provides session member accounts for participating in the session.

[0292] In this embodiment, the device status update method can be applied to the session scenario. The session management application communicates with the server through a long connection or a short connection, which can effectively solve the problem of heavy background load when only a short connection is used for communication. The organization management application can operate the session management application and send the operation result to the server. The server returns the operation result to the organization management application through a long connection or a short connection, so that the organization management application updates the current device status.

[0293] In one embodiment, Fig.13 As shown, a device status updating device 1300 is provided, which is executed by a server. The device 1300 can adopt a software module or a hardware module, or a combination of the two to become a part of the server. The device specifically includes: a long connection establishment module 1302, a long connection reconstruction module 1304, a short connection polling module 1306 and a return module 1308, wherein:

[0294] The long connection establishing module 1302 is used to establish a long connection with a first application and maintain a communication state with the first application through the long connection. The first application runs in the electronic device.

[0295] The long connection reestablishment module 1304 is used to trigger the disconnection of the long connection and reestablish a new long connection if the long connection is in an invalid state.

[0296] The short connection polling module 1306 is used to receive a status query request sent by the first application in a short connection polling manner during the process of re-establishing a new long connection, so as to maintain the communication status with the first application through the status query request until a valid long connection is re-established.

[0297] Return module 1308 is used to, in the process of maintaining the communication status, if the user account belonging to the second application is bound to the device account belonging to the first application, obtain the operation result obtained by the operation on the device account triggered by the user account through the second application, and return the operation result to the first application to which the device account belongs; the operation result is used to instruct the first application to update the device status of the electronic device.

[0298] In this embodiment, the first application runs in the electronic device, establishes a long connection with the first application, and maintains the communication status with the first application through the long connection, so that the communication between the first application and the server can be maintained for a long time, so that there is no need to re-establish communication with the server when sending and receiving data, thereby improving the efficiency of data sending and receiving, and reducing the background load.

[0299] If the long connection fails, a new long connection is re-established. In the process of re-establishing the new long connection, the status query request sent by the first application in the form of short connection polling is received, so as to maintain the communication status with the first application through the status query request until a valid long connection is re-established. This can ensure that when the long connection fails, normal communication with the server can be maintained through the short connection to avoid data transmission and reception being affected. Whether in the process of maintaining the communication status through a long connection or a short connection, if the user account belonging to the second application is bound to the device account belonging to the first application, the operation result obtained by the operation on the device account triggered by the user account is obtained through the second application, and the operation result is returned to the first application to which the device account belongs, so as to instruct the electronic device to update its own device status timely and accurately based on the operation result.

[0300] For the specific definition of the device status update device, please refer to the definition of the device status update method above, which will not be repeated here. Each module in the above-mentioned device status update device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0301] In one embodiment, a computer device is provided. The computer device may be an electronic device, and its internal structure diagram may be as shown in FIG. Fig.14 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a device status update method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0302] Those skilled in the art will understand that Fig.14The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0303] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0304] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0305] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.

[0306] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0307] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0308] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A device status updating method, characterized in that: Executed by an electronic device, the method includes: Establishing a persistent connection between the first application running locally and the server, and maintaining a communication state with the server through the persistent connection; If the persistent connection is in an invalid state, disconnect the persistent connection and re-establish a new persistent connection; In the process of re-establishing a new long connection, starting short connection polling to maintain the communication status with the server until a valid long connection is re-established; In the process of maintaining the communication state with the server through the long connection or the short connection, displaying a binding graphic code for binding with a device account belonging to the first application; After the user account belonging to the second application scans the binding graphic code, receiving binding information returned by the server indicating that the user account has been bound to the device account, the second application belonging to the user device; Based on the binding information, the binding graphic code is updated to a session graphic code and displayed; the session graphic code is used to create a session or join a created session; After the user account is bound to the device account, receiving session creation information sent by the server, which is obtained by a session creation operation triggered by the user account scanning the session graphic code and selecting a session member account; In response to the session creation information, the currently displayed session graphic code is switched to display content in the session state for display.

2. The method according to claim 1, characterized in that The step of establishing a persistent connection between the locally running first application and the server, and maintaining a communication state with the server through the persistent connection, includes: Initiate a persistent connection establishment request to the server through the first application running locally to establish a persistent connection with the server; Receiving key information returned by the server based on the established long connection; A confirmation result is generated based on the key information, and the confirmation result is sent to the server to maintain a communication state with the server.

3. The method according to claim 1, characterized in that After establishing a persistent connection between the locally running first application and the server, the method further includes: Every first preset time period, sending a heartbeat packet to the server through the long connection; If the heartbeat packet fails to be successfully sent to the server, it is determined that the long connection is in an invalid state; If the heartbeat packet is successfully sent to the server, but a response packet returned by the server for the heartbeat packet is not received within a first time period, it is determined that the long connection is in an invalid state.

4. The method according to claim 3, characterized in that The method further comprises: sending a preset request to the server through the persistent connection at intervals of a second preset time; the second preset time being longer than the first preset time; If the preset request fails to be successfully sent to the server, it is determined that the persistent connection is in an invalid state; If the preset request is successfully sent to the server, but no response information returned by the server for the preset request is received within a second time period, it is determined that the long connection is in an invalid state.

5. The method according to claim 1, characterized in that In the process of re-establishing a new long connection, starting short connection polling to maintain the communication state with the server until a valid long connection is re-established, including: In the process of re-establishing a new long connection, establishing a short connection between the first application and the server; A status query request is sent to the server through the short connection polling until a valid long connection is re-established, and then the short connection polling is stopped; wherein each status query request sent is used for the electronic device to actively obtain the latest operation result to update the device status of the electronic device in real time.

6. The method according to claim 1, characterized in that The displaying of a binding graphic code for binding with a device account belonging to the first application during the process of maintaining the communication state with the server through the long connection or the short connection includes: In the process of maintaining the communication state through the long connection, a binding graphic code for binding with the device account belonging to the first application is displayed.

7. The method according to claim 1, characterized in that The displaying of a binding graphic code for binding with a device account belonging to the first application during the process of maintaining the communication state with the server through the long connection or the short connection includes: In the process of maintaining the communication state through the short connection polling, a binding graphic code for binding with the device account belonging to the first application is displayed.

8. The method according to any one of claims 1 to 7, characterized in that The first application includes a session management application, the electronic device includes a multimedia session device for providing session room resources, and the second application includes an organization management application, and the second application provides session member accounts for participating in the session.

9. A device status update method, characterized in that: Executed by a server, the method includes: Establishing a persistent connection with a first application and maintaining a communication state with the first application through the persistent connection, wherein the first application runs in the electronic device; If the persistent connection is in an invalid state, disconnecting the persistent connection and re-establishing a new persistent connection is triggered; In the process of re-establishing a new persistent connection, receiving a status query request sent by the first application in a short connection polling manner, so as to maintain the communication status with the first application through the status query request until a valid persistent connection is re-established; In the process of maintaining the communication state with the server through the long connection or the short connection, when the user account belonging to the second application scans the binding graphic code used to bind with the device account belonging to the first application, the binding information indicating that the user account has been bound to the device account is returned to the electronic device, so that the electronic device updates the binding graphic code to a session graphic code based on the binding information and displays it; the session graphic code is used to create a session or join an already created session; After the user account is bound to the device account, session creation information obtained by the session creation operation triggered by the user account scanning the session graphic code and selecting a session member account is returned to the electronic device, so that the electronic device responds to the session creation information and switches the currently displayed session graphic code to display content in the session state.

10. A device status updating device, characterized in that: The method is performed by an electronic device, and the device includes: An establishment module is used to establish a persistent connection between a first application running locally and a server, and maintain a communication state with the server through the persistent connection; A reconstruction module, used for disconnecting the long connection and re-establishing a new long connection if the long connection is in an invalid state; A polling module, used to start short connection polling to maintain the communication status with the server during the process of re-establishing a new long connection until a valid long connection is re-established; a receiving module, configured to display a binding graphic code for binding with a device account belonging to the first application during the communication state; after a user account belonging to a second application scans the binding graphic code, receive binding information returned by the server indicating that the user account has been bound to the device account, wherein the second application belongs to the user device; An updating module, configured to update the binding graphic code to a session graphic code based on the binding information and display the code; the session graphic code is used to create a session or join an already created session; The receiving module is further configured to receive, after the user account is bound to the device account, session creation information sent by the server, obtained by a session creation operation triggered by the user account scanning the session graphic code and selecting a session member account; The updating module is further used to switch the currently displayed session graphic code to display content in the session state in response to the session creation information.

11. The device according to claim 10, characterized in that The establishment module is used to initiate a persistent connection establishment request to the server through the first application running locally to establish a persistent connection with the server; and receive key information returned by the server based on the established persistent connection; A confirmation result is generated based on the key information, and the confirmation result is sent to the server to maintain a communication state with the server.

12. The device according to claim 10, characterized in that The device also includes: A detection module is used to send a heartbeat packet to the server through the long connection every first preset time period; if the heartbeat packet cannot be successfully sent to the server, it is determined that the long connection is in an invalid state; if the heartbeat packet is successfully sent to the server, but a response packet returned by the server for the heartbeat packet is not received within a first time period, it is determined that the long connection is in an invalid state.

13. The device according to claim 12, characterized in that The detection module is further configured to send a preset request to the server through the persistent connection at intervals of a second preset duration; the second preset duration is greater than the first preset duration; If the preset request fails to be successfully sent to the server, it is determined that the persistent connection is in an invalid state; If the preset request is successfully sent to the server, but no response information returned by the server for the preset request is received within a second time period, it is determined that the long connection is in an invalid state.

14. The device according to claim 10, characterized in that The polling module is also used to establish a short connection between the first application and the server during the process of re-establishing a new long connection; send a status query request to the server through the short connection polling until a valid long connection is re-established, and then stop the short connection polling; wherein each status query request sent is used for the electronic device to actively obtain the latest operation result, so as to update the device status of the electronic device in real time.

15. The device according to claim 10, characterized in that The receiving module is also used to receive the operation result obtained by the operation on the device account triggered by the user account, which is actively returned by the server through the long connection and is triggered by the user account, if the user account belonging to the second application is bound to the device account belonging to the first application during the process of maintaining the communication status through the long connection.

16. The device according to claim 10, characterized in that The receiving module is also used to send a status query request to the server in each polling to maintain the communication status through the short connection polling, and if the user account belonging to the second application is bound to the device account belonging to the first application, receive the response result of the status query request returned by the server through the short connection; the response result includes the operation result obtained by the operation on the device account triggered by the user account.

17. The device according to any one of claims 10 to 16, characterized in that The first application includes a session management application, the electronic device includes a multimedia session device for providing session room resources, and the second application includes an organization management application, and the second application provides session member accounts for participating in the session.

18. A device status updating apparatus, characterized in that: Executed by a server, the device includes: a persistent connection establishing module, configured to establish a persistent connection with a first application and maintain a communication state with the first application through the persistent connection, wherein the first application runs in the electronic device; A long connection reestablishment module, used for triggering the disconnection of the long connection and reestablishing a new long connection if the long connection is in an invalid state; A short connection polling module, used to receive a status query request sent by the first application in a short connection polling manner during the process of re-establishing a new long connection, so as to maintain the communication status with the first application through the status query request until a valid long connection is re-established; A module for returning, to the electronic device, binding information indicating that the user account has been bound to the device account, when the user account belonging to the second application scans the binding graphic code used to bind to the device account belonging to the first application during the process of maintaining the communication state with the server through the long connection or the short connection, so that the electronic device updates the binding graphic code to a session graphic code based on the binding information and displays the code; the session graphic code is used to create a session or join an already created session; A module for returning, to the electronic device, session creation information obtained through a session creation operation triggered by scanning the session graphic code by the user account and selecting a session member account after the user account is bound to the device account, so that the electronic device switches the currently displayed session graphic code to display content in a session state in response to the session creation information.

19. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.

20. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

21. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Log-in control method and system based on two-dimension code

    CN103067378A

  • Vehicle-mounted intelligent terminal and network communication method thereof

    CN106254464A