Interactive data display method and device, electronic equipment and readable storage medium
By collaboratively filtering online user identifiers on the client and server sides and adding specified tags to interactive data, the problem of lack of interactivity in interactive data display is solved, user experience is improved, and the computational burden on the server side is reduced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-28
- Publication Date
- 2026-03-17
AI Technical Summary
In existing technologies, the way interactive data is displayed lacks interactivity and cannot effectively distinguish between interactive data from online users and offline users, resulting in a poor user experience.
By working together between the client and server, user status data is obtained and online user identifiers are filtered out. During the display of interactive data, specific tags are added to the interactive data of online users. The server only filters user identifiers and does not obtain specific interactive data, thereby reducing computational pressure.
It improves the display of interactive data, enabling users to intuitively identify online users' interactive data and reducing the computing resource costs on the server side.
Smart Images

Figure CN117312636B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to an interactive data display method, apparatus, electronic device, and readable storage medium. Background Technology
[0002] With the development of computer technology, a wide variety of applications have emerged, and their usage in daily life is increasing. To improve the user experience, most applications offer interactive features, such as bullet comments in video applications and comment functions in music and social applications.
[0003] Currently, most interactive features in applications simply display historical interaction data from different users in the interactive area. This display method has poor interactivity, and how to bring better interactive data display effects to client users has become an urgent problem to be solved. Summary of the Invention
[0004] The purpose of this invention is to provide an interactive data display method, apparatus, electronic device, and readable storage medium to improve the display effect of interactive data. The specific technical solution is as follows:
[0005] In a first aspect of this invention, an interactive data display method is provided, which is applied to a system including a server and a client, comprising:
[0006] The client responds to the user's interactive data display operation by obtaining the data packet to be displayed corresponding to the interactive data display operation.
[0007] The client obtains the user identifier corresponding to the interactive data contained in the data packet to be displayed as the identifier to be determined, generates an interactive data display request containing the identifier to be determined, and sends the interactive data display request to the server.
[0008] The server obtains the identifier to be determined carried in the interactive data display request, and obtains user status data; the identifier to be determined is the user identifier corresponding to the interactive data contained in the data packet to be displayed, and the user status data includes the current connection status of different user accounts.
[0009] Based on the user status data, the server determines the target identifier from the identifiers to be determined, where the target identifier is the user identifier corresponding to the user account whose connection status is online.
[0010] The server sends the target identifier to the client;
[0011] The client displays the interactive data in the data packet to be displayed, and adds a specified tag to the target interactive data during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target tag.
[0012] In a second aspect of this invention, another interactive data display method is also provided, applied to a server, including:
[0013] The system receives an interactive data display request from the client, obtains the identifier to be determined carried in the interactive data display request, and obtains user status data; the identifier to be determined is the user identifier corresponding to the interactive data contained in the data packet to be displayed, and the user status data includes the current connection status of different user accounts.
[0014] Based on the user status data, a target identifier is determined from the identifiers to be determined, wherein the target identifier is the user identifier corresponding to a user account whose connection status is online;
[0015] The target identifier is sent to the client.
[0016] In a third aspect of this invention, another interactive data display method is also provided, applied to a client, including:
[0017] In response to a user's interactive data display operation, obtain the data packet to be displayed corresponding to the interactive data display operation;
[0018] Obtain the user identifier corresponding to the interactive data contained in the data packet to be displayed, use it as the identifier to be determined, and generate an interactive data display request containing the identifier to be determined;
[0019] The interactive data display request is sent to the server; the server is used to obtain the identifier to be determined carried in the interactive data display request, and to obtain user status data, and based on the user status data, to determine the target identifier from the identifier to be determined, wherein the target identifier is the user identifier corresponding to the user account whose connection status is online; and to send the target identifier to the client.
[0020] Upon receiving the target identifier returned by the server in response to the interactive data display request, the interactive data contained in the data packet to be displayed is displayed, and a specified mark is added to the target interactive data corresponding to the target identifier during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target identifier.
[0021] In a fourth aspect of the present invention, an interactive data display system is also provided, the system comprising a server and a client;
[0022] The client is used to respond to the user's interactive data display operation and obtain the data packet to be displayed corresponding to the interactive data display operation;
[0023] The client is also configured to obtain the user identifier corresponding to the interactive data contained in the data packet to be displayed, as the identifier to be determined, and generate an interactive data display request containing the identifier to be determined, and send the interactive data display request to the server.
[0024] The server is used to obtain the identifier to be determined carried in the interactive data display request, and to obtain user status data; the identifier to be determined is the user identifier corresponding to the interactive data contained in the data packet to be displayed, and the user status data includes the current connection status of different user accounts.
[0025] The server is also used to determine a target identifier from the identifiers to be determined based on the user status data, wherein the target identifier is the user identifier corresponding to the user account whose connection status is online;
[0026] The server is also used to send the target identifier to the client;
[0027] The client is also used to display interactive data in the data packet to be displayed, and to add a specified marker to the target interactive data during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target identifier.
[0028] In a fifth aspect of the invention, an interactive data display device is also provided, applied to a server, comprising:
[0029] The receiving module is used to receive the interactive data display request from the client, obtain the identifier to be determined carried in the interactive data display request, and obtain user status data; the identifier to be determined is the user identifier corresponding to the interactive data contained in the data packet to be displayed, and the user status data includes the current connection status of different user accounts.
[0030] The determining module is used to determine the target identifier from the identifiers to be determined based on the user status data, wherein the target identifier is the user identifier corresponding to the user account whose connection status is online;
[0031] The sending module is used to send the target identifier to the client. The client is used to display the interactive data in the data packet to be displayed, and to add a specified mark to the target interactive data during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target identifier.
[0032] In a sixth aspect of the present invention, another interactive data display device is also provided, applied to a client, comprising:
[0033] The data packet acquisition module is used to acquire the data packet to be displayed corresponding to the user's interactive data display operation in response to the user's interactive data display operation;
[0034] The request generation module is used to obtain the user identifier corresponding to the interactive data contained in the data packet to be displayed, as the identifier to be determined, and generate an interactive data display request containing the identifier to be determined.
[0035] The request sending module is used to send the interactive data display request to the server; the server is used to obtain the identifier to be determined carried in the interactive data display request, and to obtain user status data, and based on the user status data, to determine the target identifier from the identifier to be determined, wherein the target identifier is the user identifier corresponding to the user account whose connection status is online; and to send the target identifier to the client.
[0036] The display module is used to display the interactive data contained in the data packet to be displayed when the server returns the target identifier in response to the interactive data display request, and to add a specified mark to the target interactive data corresponding to the target identifier during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target identifier.
[0037] In a seventh aspect of the present invention, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus.
[0038] Memory, used to store computer programs;
[0039] A processor, when executing a program stored in memory, implements the method described in the first, second, or third aspect above.
[0040] In an eighth aspect of the invention, a computer-readable storage medium is also provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform the methods described in the first, second, or third aspects above.
[0041] In a ninth aspect of the invention, a computer program product comprising instructions is also provided, which, when run on a computer, causes the computer to perform the methods described in the first, second, or third aspects above.
[0042] In this embodiment of the invention, the server receives interactive data display requests from the client and obtains user status data. Since the user status data includes the current connection status of different user accounts, it can filter the user identifiers corresponding to the interactive data contained in the data packet to be displayed using the user status data. This allows the client to identify the user identifiers corresponding to online user accounts, enabling the client to determine the target interactive data from the data packet based on the filtered target identifiers. Furthermore, by adding a specified marker to the target interactive data during display, this embodiment of the invention goes beyond simply displaying interactive data to the user. The specified markers allow the client's user to intuitively perceive the interactive data as belonging to an online user account, improving the display effect. Simultaneously, in this embodiment, the server only needs to filter user identifiers without obtaining the specific interactive data, thereby reducing the server's computational burden and lowering computational resource costs. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0044] Figure 1 This is a flowchart of an interactive data display method according to an embodiment of the present invention;
[0045] Figure 2 This is a schematic diagram illustrating the display after adding a specified mark in one embodiment of the present invention;
[0046] Figure 3 This is a flowchart illustrating the steps of another interactive data display method in an embodiment of the present invention;
[0047] Figure 4 This is a schematic diagram of storing data to be processed in an embodiment of the present invention;
[0048] Figure 5 This is a schematic diagram illustrating how a Bloom filter is uploaded to cloud storage space in an embodiment of the present invention;
[0049] Figure 6 This is a schematic diagram illustrating one method of obtaining a target identifier in an embodiment of the present invention;
[0050] Figure 7 This is a schematic diagram of an interactive data display architecture in an embodiment of the present invention;
[0051] Figure 8 This is a flowchart illustrating the steps of another interactive data display method in an embodiment of the present invention;
[0052] Figure 9This is a schematic diagram of the structure of an interactive data display device according to an embodiment of the present invention;
[0053] Figure 10 This is a schematic diagram of another interactive data display device in an embodiment of the present invention;
[0054] Figure 11 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0055] The technical solutions of the present invention will now be described with reference to the accompanying drawings in the embodiments of the present invention.
[0056] Figure 1 This is a flowchart illustrating an interactive data display method according to an embodiment of the present invention. This method can be applied to systems including a server and a client, such as... Figure 1 As shown, the method includes:
[0057] Step 101: The client responds to the user's interactive data display operation by obtaining the data packet to be displayed corresponding to the interactive data display operation.
[0058] Step 102: The client obtains the user identifier corresponding to the interactive data contained in the data packet to be displayed as the identifier to be determined, generates an interactive data display request containing the identifier to be determined, and sends the interactive data display request to the server.
[0059] Step 103: The server obtains the identifier to be determined carried in the interactive data display request, and obtains user status data; the identifier to be determined is the user identifier corresponding to the interactive data contained in the data packet to be displayed, and the user status data includes the current connection status of different user accounts.
[0060] Step 104: Based on the user status data, the server determines the target identifier from the identifiers to be determined. The target identifier is the user identifier corresponding to the user account whose connection status is online.
[0061] Step 105: The server sends the target identifier to the client.
[0062] Step 106: The client displays the interactive data in the data packet to be displayed, and adds a specified tag to the target interactive data during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target tag.
[0063] It should be noted that the embodiments of the present invention can be applied to any type of application, such as video applications, music applications, social applications, etc. Accordingly, the aforementioned server can be a program or device that provides video services, music services, or social services, etc., and the aforementioned client can be a program or device that provides video services, music services, or social services locally on the user's side. The interactive data in the embodiments of the present invention refers to data that enables communication between different users, such as bullet screen data, comment data, etc. Specifically, any application often has a large number of clients; therefore, the client in the embodiments of the present invention can be any client corresponding to the applied application, which can be a mobile client or a computer client, and the embodiments of the present invention do not impose any restrictions on this.
[0064] The aforementioned interactive data display operations can be triggered by users clicking preset controls. For example, in video applications, it could be triggered by users clicking the comment section, or by users enabling the bullet screen function while playing a video. Alternatively, if the bullet screen function is enabled by default, the interactive data display operation can be triggered when users click to start playing any video.
[0065] The aforementioned data package to be displayed refers to the collection of interactive data to be displayed, which can be obtained by the client through a pre-set database used to store historical interactive data. Specifically, due to the large volume of interactive data sent to the client in applications, interactive data delivery is currently typically implemented through a Content Delivery Network (CDN). For example, taking bullet screen data in video applications as an example, during video playback, hundreds of bullet screens need to be displayed every second, and each bullet screen corresponds to a different publisher, resulting in a massive amount of data. Furthermore, as the playback progresses, different bullet screens need to be displayed at different times, leading to extremely high request-per-second (QPS) responses. If the server directly handles the bullet screen delivery, it would place a significant computational burden on the server. Current CDNs, however, can significantly reduce the server's load by using edge servers (edge nodes) located in different locations to handle traffic generated by different clients. Specifically, in the scenario of bullet comment delivery, the server periodically obtains bullet comment data at different playback times and packages the bullet comment data for different minutes of playback time, uploading it to the CDN. The CDN then distributes the received bullet comment packets to different edge nodes. Correspondingly, when the client plays a certain time segment of the video, it can obtain the bullet comment packet corresponding to that time segment by accessing the nearest CDN edge node, which serves as the data packet to be displayed. Therefore, in this embodiment of the invention, the data packet to be displayed can be obtained by accessing a CDN edge node.
[0066] The aforementioned "to be determined identifier" refers to the user identifier of the publisher of the interactive data contained in the data packet to be displayed. When generating an interactive data display request, the client can include this "to be determined identifier" in the request. The aforementioned user status data includes the current connection status of different user accounts. This connection status can include online or offline status. It is understood that an online status indicates that the user account is currently connected to the server, meaning the user corresponding to that account is using the application. Conversely, an offline status indicates that the user account has lost connection to the server, and the user corresponding to that account is not currently using the application. Furthermore, the aforementioned user status data can include the current connection status of all user accounts, or it can only include user accounts with an online connection status. The specific settings can be customized according to actual needs, and this embodiment of the invention does not impose any limitations on this.
[0067] In step 103 above, the online status of different user accounts can be determined by session status or by a heartbeat mechanism. User status data is then generated based on the determination result. This embodiment of the invention does not limit the specific determination method. For example, after a user account logs into the client and connects to the server, a session record is generated and stored. The session record may contain the user's identifier. If the user interacts with the server within a specified time, the session status of the session record remains active, indicating that the user account is online. Conversely, if the user does not interact with the server within the specified time, the session status of the session record can be updated to a stagnant state or the session record can be directly deleted, indicating that the user account is offline. Another example is that after a user account logs into the client and connects to the server, the client periodically sends heartbeat packets to the server. If no heartbeat packet is received within a specified time, the user account is determined to be offline.
[0068] Furthermore, after obtaining the user status data, the server can use any identifier to traverse the user accounts and connection statuses contained in the user status data, and compare the user identifiers corresponding to the user accounts contained in the user status data in turn. If the comparisons match and the connection status is online, then the identifier to be determined can be identified as the target identifier.
[0069] The specified marker can be a specified color or style. It could be adding a dot of a specified color before the target interactive data, bolding or underlining the font of the target interactive data, setting the font of the target interactive data to green and other interactive data to black, or simply adding the word "online" directly to the target interactive data. The specific form of the marker can be customized according to actual needs. This embodiment of the invention does not limit the specific form of the specified marker. For example, taking bullet screen data in a video application as an example... Figure 2 This is a schematic diagram illustrating the display after adding a specified mark in an embodiment of the present invention, such as... Figure 2 As shown in the figure, the bullet comments with dashed outlines represent target interactive data. Furthermore, in this embodiment of the invention, the determined target identifier can be directly sent to the client. After receiving the target identifier, the client can add a specified marker to the target interactive data when displaying the interactive data in the data package to be displayed. This allows users on the client to intuitively perceive the interactive data belonging to their online user account when viewing the displayed interactive data, thus enhancing the user's sense of interaction.
[0070] Figure 3 This is a flowchart illustrating the steps of another interactive data display method according to an embodiment of the present invention. This method can be applied to a server, such as... Figure 3 As shown, the method includes:
[0071] Step 201: Receive the interactive data display request from the client, obtain the identifier to be determined carried in the interactive data display request, and obtain user status data; the identifier to be determined is the user identifier corresponding to the interactive data contained in the data packet to be displayed, and the user status data includes the current connection status of different user accounts.
[0072] Step 202: Based on the user status data, determine the target identifier from the identifiers to be determined. The target identifier is the user identifier corresponding to the user account whose connection status is online.
[0073] Step 203: Send the target identifier to the client. The client is used to display the interactive data in the data packet to be displayed, and add a specified mark to the target interactive data during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target identifier.
[0074] In summary, in this embodiment of the invention, the server receives interactive data display requests from the client and obtains user status data. Since the user status data includes the current connection status of different user accounts, it can filter the user identifiers corresponding to the interactive data contained in the data packet to be displayed using the user status data. This allows the client to identify the user identifiers corresponding to online user accounts, enabling the client to determine the target interactive data from the data packet based on the filtered target identifiers. Furthermore, by adding a specified marker to the target interactive data during display, this embodiment of the invention goes beyond simply displaying interactive data to the user. The specified markers allow the client's user to intuitively perceive the interactive data as belonging to an online user account, improving the display effect. Simultaneously, in this embodiment, the server only needs to filter user identifiers without obtaining the specific interactive data, thereby reducing the server's computational burden and lowering computational resource costs.
[0075] Optionally, in this embodiment of the invention, the server may include a first server and a second server. Accordingly, in step 201, the first server may receive the client's interactive data display request, and steps 202-203 are also executed by the first server. Before receiving and acquiring user status data in step 201, this embodiment of the invention may further include the following steps:
[0076] S21. When the second server receives a service access request sent by any user account through the client, it establishes a long connection with the client; the client is used to send a heartbeat packet to the second server at a first frequency through the long connection, and the heartbeat packet contains the user identifier of the user account.
[0077] S22. When the second server receives a heartbeat packet sent by the client through a long connection, it obtains the user identifier contained in the heartbeat packet and stores the correspondence between the user identifier and the heartbeat time as data to be processed in a preset distributed database. The heartbeat time is the time when the heartbeat packet is received.
[0078] Accordingly, the operation of obtaining user status data in step 201 above may specifically include: S23, the first server obtains user status data based on the correspondence between the user identifier and the heartbeat time stored in the distributed database.
[0079] In this context, the user account refers to a registered account within the application belonging to the server. This account can log in to the client and interact with the server to obtain the services provided. The service access request refers to the client's request to access the server's domain name. The long connection refers to a persistent connection, eliminating the need to re-establish a connection for each communication, thus reducing network overhead and enabling real-time bidirectional communication. Specifically, the long connection can be established using a long-connection communication protocol, such as Transmission Control Protocol (TCP). TCP can achieve long connections by setting the "keepalive" parameter. Alternatively, the long connection can also be established using Hypertext Transfer Protocol (HTTP), and this embodiment of the invention does not impose any limitations on this. The second server can be a pre-defined server device used to establish long connections.
[0080] Specifically, when a user launches the client, the client initiates an access to the server's domain name via the communication module. The second server in the server can establish a long connection with the client by responding to this service access request. Further, after establishing the long connection, the client can periodically send heartbeat packets to the second server through the long connection. These heartbeat packets are used to inform the second server of the connection status. The heartbeat packets may only contain the user identifier of the user account logged in by the client, or they may also include preset notification information and a device identifier. The specific settings can be customized according to actual needs, and this embodiment of the invention does not impose any limitations on this. The aforementioned first frequency can be preset, such as 0.2Hz, 0.1Hz, etc., and this embodiment of the invention does not impose any limitations on this.
[0081] Furthermore, the second server can store the connection status of the logged-in user account on the client by receiving heartbeat packets sent by the client. Specifically, since the heartbeat packets are sent at the first frequency through a long connection, and the long connection will remain open as long as no abnormalities occur on the client or server, and the user has not logged out or closed the client, the server's receipt of the heartbeat packet indicates that the user account corresponding to the user identifier contained in the heartbeat packet is currently online. The aforementioned client abnormalities may be caused by program malfunctions, device restarts, or network instability, while the aforementioned server abnormalities may be caused by server crashes, network abnormalities, program malfunctions, or excessive load.
[0082] The aforementioned distributed database refers to a distributed cache, which can be a Remote Dictionary Server (REDIS). Specifically, a connection can be established with the distributed cache server using a REDIS tool (such as redis-cli), and a distributed database can be created within REDIS to store user states. Specifically, when the second server receives a heartbeat packet from any client, it uses the user identifier contained in the heartbeat packet as the key and the time the heartbeat packet was received as the value, thus storing the data to be processed in key-value pair format.
[0083] Furthermore, when the second server receives a heartbeat packet from any client, it can also query the distributed database based on the user identifier contained in the heartbeat packet. When a value corresponding to the user identifier is found, the heartbeat time of the heartbeat packet can be used to update the value, so that the heartbeat time of the data to be processed stored in the distributed database remains at the time when the corresponding client last sent a heartbeat packet, thus ensuring the timeliness of the user status stored in the distributed database.
[0084] Optionally, embodiments of the present invention can also perform sharded storage for Redis, that is, assigning different data sub-databases to different user identifiers in Redis to improve the efficiency of subsequent data retrieval. For example, 10 data sub-databases can be established in Redis, with shard numbers from 0 to 9. Specifically, a sharding function can receive the user identifier as input and output a number from 0 to 9. The sharding function can be a hash function, such as consistent hashing or modulo operation. When it is necessary to save data to be processed containing a certain user identifier to Redis, the shard number corresponding to the user identifier is first calculated using the sharding function, and then the data to be processed is stored in the corresponding data sub-database. Furthermore, when it is necessary to query the heartbeat time of a certain user identifier, the shard number can also be calculated first using the sharding function, and then the data can be read from the relevant data sub-database, which can greatly improve the efficiency of data retrieval.
[0085] Accordingly, in this embodiment of the invention, the first server can obtain user status data through a distributed database. Specifically, it can determine the connection status of the corresponding user identifier based on the heartbeat time of each piece of data to be processed stored in the distributed database. Specifically, if the time elapsed between the heartbeat time and the current time for any piece of data to be processed exceeds a preset time threshold, the connection status corresponding to the user identifier of that piece of data to be processed is determined to be offline, and the data to be processed can be deleted. Conversely, if the time elapsed between the heartbeat time and the current time is not greater than the preset time threshold, the connection status of the corresponding user identifier is determined to be online. The preset time threshold can be set arbitrarily, for example, 1 minute, 30 seconds, 40 seconds, etc., and this embodiment of the invention does not impose any restrictions on it.
[0086] For example, Figure 4 This is a schematic diagram of storing data to be processed in an embodiment of the present invention, such as... Figure 4 As shown, the TCP server refers to the second server mentioned above, which is the server used to establish long-lived connections with the client. Specifically, the client can send heartbeat packets to the TCP server through the long-lived connection. Correspondingly, the TCP server can use the user identifier in the heartbeat packet to deliver the heartbeat event to the distributed cache, that is, store the pending data containing the user identifier and the heartbeat time, thereby realizing the storage of user online events.
[0087] In this embodiment of the invention, the second server establishes a long connection with the client upon receiving a service access request from any user account sent through the client. The client sends heartbeat packets to the second server at a first frequency via the long connection, and the heartbeat packets contain the user identifier of the user account. Upon receiving the heartbeat packets sent by the client through the long connection, the second server obtains the user identifier contained in the heartbeat packets and stores the correspondence between the user identifier and the heartbeat time as pending data in a preset distributed database. The heartbeat time is the time when the heartbeat packets are received. The first server obtains user status data based on the correspondence between the user identifier and the heartbeat time stored in the distributed database. Thus, by establishing a long connection with the client when the client accesses the second server and receiving the heartbeat packets sent by the client through the long connection, the connection status of different user accounts can be accurately determined through the long connection and heartbeat packets. Furthermore, by using a distributed database to store the user identifier and the heartbeat time, the resource overhead of using ordinary storage methods (such as disk storage) can be reduced to a certain extent. Additionally, distributed databases are typically memory-based storage with high read efficiency, thereby improving the efficiency of obtaining user status data. Furthermore, by setting up a first server and a second server, with the second server establishing a long connection and storing data to be processed, the computational and resource pressure on the first server can be reduced.
[0088] Optionally, the aforementioned server may further include a third server. After storing the correspondence between the user identifier and heartbeat time as data to be processed in a preset distributed database, the embodiments of the present invention may further include the following steps:
[0089] S31. The third server obtains the data to be processed stored in the distributed database at the second frequency.
[0090] S32. For any of the data to be processed, if the time difference between the heartbeat time in the data to be processed and the current time does not exceed a preset time threshold, the third server determines that the connection status of the user account corresponding to the user identifier in the data to be processed is online, and determines the user identifier in the data to be processed as a filter identifier.
[0091] S33. The third server constructs a Bloom filter and stores the identifiers to be filtered into the Bloom filter.
[0092] The first server mentioned above obtains user status data based on the correspondence between the user identifier and heartbeat time stored in the distributed database, including:
[0093] S34. The first server obtains a Bloom filter through the third server to obtain user status data based on the filter identifiers stored in the Bloom filter.
[0094] The operation of determining the target identifier from the identifiers to be determined based on the user state data, as described above, may specifically include the following in embodiments of the present invention:
[0095] S35. Based on the identifiers to be screened stored in the Bloom filter, filter the identifiers to be determined to obtain the target identifiers.
[0096] The third server mentioned above can be a pre-configured server device for building Bloom filters. The second frequency can be the same as or different from the first frequency, and can be set according to actual needs. This embodiment of the invention does not impose any restrictions on this. Specifically, this embodiment of the invention can set a scheduled task, the execution frequency of which is the second frequency, and the scheduled task is used to retrieve the stored data to be processed from the distributed database.
[0097] The aforementioned preset duration threshold can be set by the user, for example, 1 minute, 30 seconds, 40 seconds, etc., and this embodiment of the invention does not impose any restrictions on this. Further, for the acquired data to be processed, the heartbeat time of each piece of data can be determined sequentially. Specifically, the time difference between the heartbeat time and the current time can be obtained. If the time difference does not exceed the preset duration threshold, it indicates that the user account corresponding to the user identifier of the data to be processed is online, and it can be further identified as a filter identifier. Correspondingly, the connection status of the user account corresponding to the filter identifier is online. Further, if the aforementioned time difference exceeds the preset duration threshold, it indicates that the user account corresponding to the user identifier of the data to be processed is offline, and the data to be processed can be directly deleted.
[0098] The Bloom filter mentioned above refers to a Bloom filter, which can be an array containing a number of elements. In a Bloom filter, each element occupies a small size, significantly reducing storage resource consumption and resulting in high space and query efficiency. Specifically, when recording data, a Bloom filter generates multiple hash values using a hash function, and then sets the corresponding bits of these hash values to 1. Correspondingly, the presence of the query element in the Bloom filter can be determined by the specific values of the different bits in the Bloom filter.
[0099] Specifically, this embodiment of the invention stores the aforementioned identifiers to be filtered by constructing a Bloom filter. This allows the Bloom filter to store user identifiers whose connection status is always online. The connection status of the identifier to be determined can then be judged using the Bloom filter. In this case, the Bloom filter can be equivalent to user status data containing all user identifiers with online status. Thus, the first server can obtain the Bloom filter by accessing the third server, and by obtaining the Bloom filter, it can retrieve the user identifiers of user accounts with online connection status. This embodiment of the invention can construct the Bloom filter using a Bloom filter construction tool (Guava BloomFilter), and the storage capacity and error rate of the Bloom filter can be set according to actual needs.
[0100] Furthermore, in this embodiment of the invention, when determining the target identifier, the identifier to be determined can be directly filtered by a Bloom filter to obtain the filtering result corresponding to each identifier to be determined. The identifier to be determined that belongs to the Bloom filter can be used as the target identifier.
[0101] In this embodiment of the invention, by setting a second frequency, the latest data to be processed can be periodically and promptly retrieved from the distributed database. Simultaneously, by identifying filterable identifiers from the data to be processed whose heartbeat time difference from the current time does not exceed a preset time threshold, the online user identifiers can be accurately obtained. Furthermore, by constructing a Bloom filter to record filterable identifiers and determining target identifiers through the Bloom filter, there is no need to retrieve target identifiers from the distributed database, reducing the large number of read operations on the distributed database. The advantages of Bloom filters in query efficiency and space efficiency can be leveraged to further reduce the occupation of server-side storage resources and improve the efficiency of determining target identifiers from the filterable identifiers. This allows the server to respond to client interactive data display requests and return target identifiers in a shorter time, further improving client display efficiency. In addition, by setting a third server to retrieve data from the distributed database to construct the Bloom filter, the first server can directly obtain user status data from the third server, eliminating the need for the first server to access the distributed database to retrieve and process the data to be processed, further reducing the computational burden on the first server.
[0102] Optionally, after the third server constructs the Bloom filter as described above, the embodiments of the present invention may further include the following steps:
[0103] S41. The third server uploads the constructed Bloom filter to the cloud storage space according to the second frequency, and deletes the constructed Bloom filter in the third server.
[0104] S42. The first server retrieves the stored Bloom filter from the cloud storage space according to the third frequency and stores it in the preset cache.
[0105] The operation of the first server obtaining the Bloom filter through the third server, as described above, can specifically include the following in this embodiment of the invention:
[0106] S43. The first server reads the stored Bloom filter from the preset cache.
[0107] The aforementioned cloud storage space can be provided by a cloud storage service. A certain capacity of cloud storage space can be pre-allocated from the cloud storage service for storing the Bloom filter. For example, the aforementioned cloud storage space can be provided by an object storage service (OSS), but it can also be provided by other cloud storage services; this embodiment of the invention does not impose any restrictions on this.
[0108] Specifically, when uploading a Bloom filter to cloud storage, the third-party server can first dump the Bloom filter as a text file to a local file on the server, facilitating subsequent upload operations. Furthermore, after uploading the Bloom filter as a file, the third-party server can delete the Bloom filter from the local file to avoid consuming server storage resources.
[0109] In order to ensure that the first server can obtain the latest user status data through the preset cache, a third frequency higher than the first frequency and / or the second frequency can be set, such as 1HZ, 10HZ, etc. The specific frequency can be set according to the frequency and number of requests initiated by the client. This embodiment of the invention does not limit this.
[0110] The aforementioned preset cache refers to the local cache of the first server, which can be pre-established on the first server. Further, in this embodiment of the invention, the first server can pull Bloom filters from the cloud storage space at a third frequency and store them in the preset cache. Then, when receiving an interactive data display request from the client, it can directly obtain the Bloom filter from the preset cache. This reduces the storage resource consumption of the third server by utilizing cloud storage space, and the first server does not need to access the distributed database or cloud storage space when receiving the client's interactive data display request. This can reduce the latency of obtaining user status data to a certain extent, reduce unnecessary input / output (IO), and lower costs.
[0111] For example, Figure 5 This is a schematic diagram illustrating the uploading of a Bloom filter to cloud storage space in an embodiment of the present invention, as shown below. Figure 5As shown, the third-party server can construct a Bloom filter and dump the constructed Bloom filter from the server's memory to a local file, thereby uploading the Bloom filter to the cloud storage space as a file. The cloud storage space can be a distributed storage system.
[0112] In this embodiment of the invention, by setting up different servers, each server performs different operations, the storage pressure on the first server and the request response pressure on the third server can be reduced. Only a small number of first and third servers are needed to display the user's online status in the interactive data display, which has the ability to expand rapidly.
[0113] Furthermore, Figure 6 This is a schematic diagram of obtaining a target identifier in an embodiment of the present invention, such as... Figure 6 As shown, the client can send an interactive data display request carrying the identifier to be determined to the first server. The first server can use a scheduled task to asynchronously pull the bloomFilter from the cloud storage space and store it in the local cache. Thus, when the first server receives the interactive data display request, it can batch filter the identifier to be determined from the bloomFilter in the local cache and determine the target identifier, avoiding the delay caused by interacting with the distributed database or cloud storage space.
[0114] In this embodiment of the invention, the third server uploads the constructed Bloom filter to the cloud storage space according to the second frequency; the first server retrieves the stored Bloom filter from the cloud storage space according to the third frequency and stores it in a preset cache; and reads the stored Bloom filter from the preset cache. By retrieving the Bloom filter from the cloud storage space according to the third frequency and storing it in the preset cache, the first server can directly retrieve the Bloom filter from the preset cache when it receives an interactive data display request from the client. This reduces the local storage resource consumption of the third server by utilizing the cloud storage space, and eliminates the need to access the distributed database or cloud storage space when receiving an interactive data display request from the client. This reduces the latency of obtaining user status data and unnecessary input / output (IO), thus lowering costs.
[0115] Figure 7 This is a schematic diagram of an interactive data display architecture in an embodiment of the present invention, such as... Figure 7As shown, both the client and server can implement long-lived connection services to establish a persistent connection between them. The server can provide online services to users through this long-lived connection, storing the client's heartbeat time and user identifier to determine if the user is still online. Furthermore, to reduce the consumption of server-side storage resources, distributed cloud storage and distributed databases can be used to store Bloom filters and data to be processed when implementing online services on the server side. The server can also implement user authorization services, determining whether different users are allowed to display their connection status. The client, by receiving the target identifier after the server's online determination, can display the online status to the user, adding a specified marker to the target interactive data during the display process. This improves the display effect of interactive data and effectively enhances users' willingness to interact.
[0116] Optionally, before receiving the client's interactive data display request, the embodiments of the present invention may further include the following steps:
[0117] S51. When the third server receives a status display request from any user account, it adds the user's identifier to the display account set; the display account set includes user identifiers of user accounts that are allowed to display connection status.
[0118] The operation of determining the user identifier in the data to be processed as the identifier to be filtered, as described above, may specifically include the following in this embodiment of the invention:
[0119] S52. If the user identifier in the data to be processed belongs to the set of displayed accounts, the user identifier in the data to be processed is determined as the identifier to be filtered.
[0120] The aforementioned status display request can be sent by the user account through the login client, and the status display request can be a request to indicate that status display should be enabled.
[0121] Specifically, a status display control ON / OFF can be pre-configured in the client. The user can trigger the status display control to ON, causing the client to send a status display request. Alternatively, the client can send a status display request by receiving a voice command from the user to enable the status display. This embodiment of the invention does not impose any limitations on this. Furthermore, the aforementioned set of display accounts includes user identifiers for user accounts that are allowed to display connection status, which can be pre-stored in the database of a third-party server.
[0122] Understandably, when a user identifier in the data to be processed belongs to the set of display accounts, it indicates that the user account corresponding to that user identifier is allowed to display its connection status. In this case, the user identifier can be identified as a filter identifier to meet the privacy needs of different users. Conversely, when a user identifier in the data to be processed does not belong to the set of display accounts, it indicates that the user account corresponding to that user identifier is not allowed to display its connection status.
[0123] Optionally, the system can also receive a display shutdown request from any user account, and upon receiving such a request, remove the user ID corresponding to that user account from the display account set, thereby improving display flexibility. The aforementioned display shutdown request can be generated by triggering the aforementioned status display control to OFF, or it can be sent by the client through a voice command indicating that the status display is to be turned off; this embodiment of the invention does not impose any limitations on this.
[0124] In this embodiment of the invention, upon receiving a status display request from any user account, the user identifier of that user account is added to a set of display accounts. This set of display accounts includes user identifiers of user accounts allowed to display connection status. If a user identifier in the pending data belongs to this set of display accounts, that user identifier in the pending data is identified as a filter identifier. Thus, by setting a set of display accounts, it is possible to determine whether a user account is allowed to display connection status according to its actual needs. Only when a user account allows display is the corresponding user identifier identified as a filter identifier, allowing user accounts to independently set the display of connection status and improving flexibility.
[0125] Optionally, after establishing a long connection with the client, the embodiments of the present invention may further include the following steps:
[0126] S61. When the second server receives a disconnection request sent by the client through a long connection, it obtains the user identifier carried in the disconnection request as the disconnection identifier.
[0127] S62. Delete the pending data containing the disconnection identifier from the distributed database.
[0128] The aforementioned disconnection request may be generated by the client when a user logs out or closes the client, and may include the user identifier of the user account that logged out or closed the client. Accordingly, upon receiving a disconnection request carrying the user identifier, it indicates that the user account corresponding to the user identifier is offline. Therefore, this embodiment of the invention can delete the pending data containing the user identifier from the distributed database to update the connection status of the disconnected user account in a timely manner.
[0129] In this embodiment of the invention, the second server, upon receiving a disconnection request sent by the client via a long-lived connection, obtains the user identifier carried in the disconnection request as a disconnection identifier; and deletes the pending data containing the disconnection identifier from the distributed database. Thus, by deleting the corresponding pending data upon receiving a disconnection request, the connection status of the disconnected user account can be updated promptly.
[0130] Figure 8 This is a flowchart illustrating the steps of another interactive data display method in this embodiment of the invention, which can be applied to a client, such as... Figure 8 As shown, it includes:
[0131] Step 301: In response to the user's interactive data display operation, obtain the data packet to be displayed corresponding to the interactive data display operation;
[0132] Step 302: Obtain the user identifier corresponding to the interactive data contained in the data packet to be displayed, use it as the identifier to be determined, and generate an interactive data display request containing the identifier to be determined.
[0133] Step 303: Send the interactive data display request to the server;
[0134] Step 304: Upon receiving the target identifier returned by the server in response to the interactive data display request, display the interactive data contained in the data packet to be displayed, and add a specified mark to the target interactive data corresponding to the target identifier during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target identifier.
[0135] The aforementioned client refers to a program or device that provides services such as video, music, or social networking services locally on the user's side. This can be a mobile client or a computer client, and this embodiment of the invention does not impose any limitations on this. The aforementioned interactive data display operation can be triggered by the user clicking a preset control; for example, in a video application, it could be the user clicking the comment section or the user enabling the bullet comment function.
[0136] The aforementioned data packet to be displayed refers to the collection of interactive data to be displayed, which can be obtained through a pre-defined database for storing historical interactive data, such as through edge nodes in a CDN. Further, the user identifier of the interactive data contained in the data packet to be displayed can be obtained to generate the aforementioned interactive data display request, which is then sent to the server. The server then uses the identifiers to be determined carried in the interactive data display request to detect the target identifier whose connection status is online. The server obtains the identifiers to be determined carried in the interactive data display request, as well as user status data, and based on the user status data, determines the target identifier from the identifiers to be determined. The target identifier is the user identifier corresponding to the user account whose connection status is online, and sends the target identifier to the client.
[0137] Furthermore, after receiving the target identifier, the client can add a specified marker to the target interactive data corresponding to the target identifier when displaying the interactive data contained in the data package to be displayed. Specifically, after receiving the target identifier, the client can first set display attributes for the interactive data in the data package to be displayed, and distinguish the display attributes of the target interactive data in the data package to be displayed. The display attributes can include color attributes, font attributes, etc. Accordingly, the display attributes of the target interactive data can be set to the specified marker attribute value, and the display attributes of other interactive data can be set to ordinary attribute values. Then, the client can output the set data package to be displayed for display. Alternatively, the client can output and display the interactive data sequentially according to the display order of each interactive data. Before displaying the target interactive data, the client can modify its display attribute value to add a specified marker to the target interactive data before outputting and displaying it. This embodiment of the invention does not limit this.
[0138] Optionally, after the target interaction data is displayed, client users can intuitively view the interaction data belonging to online users. Furthermore, users can engage in real-time chat by clicking on the target interaction data and the user account corresponding to the target identifier, thereby improving the real-time nature of the interaction.
[0139] This invention, in its embodiments, sends an interactive data display request carrying an identifier to be determined to the server before displaying interactive data. This allows the server to determine the target identifier whose connection status is online. The client can then determine the target interactive data from the data packets to be displayed based on the selected target identifier. Furthermore, by adding a specified marker to the target interactive data when displaying it, this invention goes beyond simply displaying interactive data to the user. By using the specified marker, the client can intuitively perceive that the interactive data belongs to an online user account, thus improving the display effect of the interactive data.
[0140] Optionally, embodiments of the present invention also provide an interactive data display system, the system including a server and a client;
[0141] The client is used to respond to the user's interactive data display operation and obtain the data packet to be displayed corresponding to the interactive data display operation;
[0142] The client is also configured to obtain the user identifier corresponding to the interactive data contained in the data packet to be displayed, as the identifier to be determined, and generate an interactive data display request containing the identifier to be determined, and send the interactive data display request to the server.
[0143] The server is used to obtain the identifier to be determined carried in the interactive data display request, and to obtain user status data; the identifier to be determined is the user identifier corresponding to the interactive data contained in the data packet to be displayed, and the user status data includes the current connection status of different user accounts.
[0144] The server is also used to determine a target identifier from the identifiers to be determined based on the user status data, wherein the target identifier is the user identifier corresponding to the user account whose connection status is online;
[0145] The server is also used to send the target identifier to the client;
[0146] The client is also used to display interactive data in the data packet to be displayed, and to add a specified marker to the target interactive data during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target identifier.
[0147] Figure 9 This is a schematic diagram of an interactive data display device according to an embodiment of the present invention. This device is applied to a server, such as... Figure 9 As shown, the device 70 may include:
[0148] The receiving module 701 is used to receive an interactive data display request from the client, obtain the identifier to be determined carried in the interactive data display request, and obtain user status data; the identifier to be determined is the user identifier corresponding to the interactive data contained in the data packet to be displayed, and the user status data includes the current connection status of different user accounts.
[0149] The determining module 702 is used to determine a target identifier from the identifiers to be determined based on the user status data, wherein the target identifier is the user identifier corresponding to a user account whose connection status is online;
[0150] The sending module 703 is used to send the target identifier to the client. The client is used to display the interactive data in the data packet to be displayed, and to add a specified mark to the target interactive data during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target identifier.
[0151] Optionally, the server includes a first server and a second server; the receiving module is specifically used for: the first server receiving an interactive data display request from the client;
[0152] The device 70 further includes:
[0153] A connection establishment module is used to establish a long connection with the client when the second server receives a service access request sent by any user account through the client; the client is used to send a heartbeat packet to the second server at a first frequency through the long connection, and the heartbeat packet contains the user identifier of the user account;
[0154] The identifier acquisition module is used by the second server to acquire the user identifier contained in the heartbeat packet when it receives the heartbeat packet sent by the client through a long connection, and to store the correspondence between the user identifier and the heartbeat time as data to be processed in a preset distributed database. The heartbeat time is the time when the heartbeat packet is received.
[0155] The receiving module 701 is specifically used for: the first server to obtain user status data based on the correspondence between the user identifier and the heartbeat time stored in the distributed database.
[0156] Optionally, the server may further include a third server, and the device 70 may further include:
[0157] The pending data acquisition module is used by the third server to acquire pending data stored in the distributed database at a second frequency.
[0158] The filter determination module is used by the third server to determine, for any data to be processed, that the connection status of the user account corresponding to the user identifier in the data to be processed is online, and to determine the user identifier in the data to be processed as the filter identifier, provided that the time difference between the heartbeat time and the current time in the data to be processed does not exceed a preset duration threshold.
[0159] The construction module is used by the third server to construct a Bloom filter and store the identifiers to be filtered into the Bloom filter;
[0160] The receiving module 701 is specifically used for: the first server to obtain a Bloom filter through the third server, so as to obtain user status data based on the filter identifier stored in the Bloom filter;
[0161] The determining module 702 is specifically used to: filter the identifiers to be determined based on the identifiers to be screened stored in the Bloom filter to obtain the target identifiers.
[0162] Optionally, the device 70 further includes:
[0163] The upload module is used by the third server to upload the constructed Bloom filter to the cloud storage space according to the second frequency, and to delete the constructed Bloom filter in the third server.
[0164] The storage module is used by the first server to retrieve the stored Bloom filters from the cloud storage space at a third frequency and store them in a preset cache.
[0165] The receiving module 701 is specifically used for: the first server reading the stored Bloom filter from the preset cache.
[0166] Optionally, the device 70 further includes:
[0167] The identifier addition module is used by the third server to add the user identifier of any user account to the display account set when it receives a status display request from any user account; the display account set includes user identifiers of user accounts that are allowed to display connection status.
[0168] The filter determination module is specifically used to: determine the user identifier in the data to be processed as the filter identifier when the user identifier in the data to be processed belongs to the set of displayed accounts.
[0169] Optionally, the device 70 further includes:
[0170] The disconnection acquisition module is used by the second server to obtain the user identifier carried in the disconnection request when it receives a disconnection request sent by the client through a long connection, and use it as a disconnection identifier;
[0171] The deletion module is used to delete the pending data containing the disconnection identifier from the distributed database.
[0172] In summary, the interactive data display device provided in this embodiment of the invention allows the server to receive interactive data display requests from clients and obtain user status data. Since the user status data includes the current connection status of different user accounts, it can filter the user identifiers corresponding to the interactive data contained in the data packet to be displayed. This allows the client to identify the user identifiers corresponding to online user accounts, enabling the client to determine the target interactive data from the data packet based on the filtered target identifiers. Furthermore, by adding a designated marker to the target interactive data during display, this embodiment of the invention goes beyond simply displaying interactive data to the user. The designated marker allows the client to intuitively perceive the interactive data belonging to an online user account, improving the display effect. Simultaneously, the server in this embodiment only needs to filter user identifiers without acquiring the specific interactive data, thereby reducing the server's computational burden and lowering computational resource costs.
[0173] Figure 10 This is a schematic diagram of another interactive data display device according to an embodiment of the present invention. This device is applied to a client, such as... Figure 10 As shown, the device 80 may include:
[0174] The data packet acquisition module 801 is used to acquire the data packet to be displayed corresponding to the user's interactive data display operation in response to the user's interactive data display operation;
[0175] The request generation module 802 is used to obtain the user identifier corresponding to the interactive data contained in the data packet to be displayed, as the identifier to be determined, and generate an interactive data display request containing the identifier to be determined.
[0176] The request sending module 803 is used to send the interactive data display request to the server; the server is used to obtain the identifier to be determined carried in the interactive data display request, and to obtain user status data, and based on the user status data, to determine the target identifier from the identifier to be determined, wherein the target identifier is the user identifier corresponding to the user account whose connection status is online; and to send the target identifier to the client.
[0177] The display module 804 is used to display the interactive data contained in the data packet to be displayed when the server returns the target identifier in response to the interactive data display request, and to add a specified mark to the target interactive data corresponding to the target identifier during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target identifier.
[0178] This invention also provides an electronic device, such as... Figure 11 As shown, it includes a processor 9001, a communication interface 9002, a memory 9003, and a communication bus 9004. The processor 9001, communication interface 9002, and memory 9003 communicate with each other via the communication bus 9004.
[0179] The 9003 memory is used to store computer programs;
[0180] When processor 9001 executes the program stored in memory 9003, it performs the following steps:
[0181] The system receives an interactive data display request from the client, obtains the identifier to be determined carried in the interactive data display request, and obtains user status data; the identifier to be determined is the user identifier corresponding to the interactive data contained in the data packet to be displayed, and the user status data includes the current connection status of different user accounts.
[0182] Based on the user status data, a target identifier is determined from the identifiers to be determined, wherein the target identifier is the user identifier corresponding to a user account whose connection status is online;
[0183] The target identifier is sent to the client, which is used to display the interactive data in the data packet to be displayed, and to add a specified tag to the target interactive data during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target identifier.
[0184] Alternatively, when processor 9001 executes a program stored in memory 9003, it performs the following steps:
[0185] In response to a user's interactive data display operation, obtain the data packet to be displayed corresponding to the interactive data display operation;
[0186] Obtain the user identifier corresponding to the interactive data contained in the data packet to be displayed, use it as the identifier to be determined, and generate an interactive data display request containing the identifier to be determined;
[0187] Send the interactive data display request to the server;
[0188] Upon receiving the target identifier returned by the server in response to the interactive data display request, the interactive data contained in the data packet to be displayed is displayed, and a specified mark is added to the target interactive data corresponding to the target identifier during the display process. The target interactive data is the interactive data in the data packet to be displayed that corresponds to the target identifier.
[0189] The processor 9001, when executing the program stored in the memory 9003, can also implement other steps in the interactive data display method described above, which will not be elaborated here.
[0190] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0191] The communication interface is used for communication between the aforementioned terminal and other devices.
[0192] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0193] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0194] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the interactive data display methods described in the above embodiments.
[0195] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the interactive data display methods described in the above embodiments.
[0196] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).
[0197] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0198] It should be noted that the various data-related processes in the embodiments of this application are carried out in compliance with the relevant data protection laws and policies of the country where the location is located, and with the authorization granted by the owner of the corresponding device.
[0199] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0200] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. An interactive data presentation method, characterized by, The method is applied to a system comprising a server and a client, the server comprising a first server and a second server, and the method comprises: The client acquires a data package to be displayed corresponding to an interactive data display operation of a user in response to the interactive data display operation of the user; The client acquires a user identifier corresponding to the interactive data in the data package to be displayed as a to-be-determined identifier, and generates an interactive data display request comprising the to-be-determined identifier, and sends the interactive data display request to the server; The first server receives the interactive data display request of the client; The second server establishes a long connection with the client upon receiving a service access request sent by any user account through the client; The client sends a heartbeat packet to the second server at a first frequency through the long connection, and the heartbeat packet comprises a user identifier of the user account; The second server acquires the user identifier comprised in the heartbeat packet upon receiving the heartbeat packet sent by the client through the long connection, and stores the correspondence between the user identifier and a heartbeat time as to-be-processed data in a preset distributed database, the heartbeat time being the time of receiving the heartbeat packet; The server acquires the to-be-determined identifier carried by the interactive data display request; the to-be-determined identifier is a user identifier corresponding to the interactive data comprised in the data package to be displayed; The first server acquires user state data based on the correspondence between the user identifier and the heartbeat time stored in the distributed database, the user state data comprising current connection states of different user accounts; The server determines a target identifier from the to-be-determined identifier based on the user state data, the target identifier being a user identifier corresponding to a user account in an online state; The server sends the target identifier to the client; The client displays the interactive data in the data package to be displayed, and adds a specified mark to target interactive data in the display process, the target interactive data being interactive data corresponding to the target identifier in the data package to be displayed.
2. An interactive data presentation method, characterized by, The method is applied to a server, the server comprising a first server and a second server; and the method comprises: The second server establishes a long connection with the client upon receiving a service access request sent by any user account through the client; and the client is configured to send a heartbeat packet to the second server at a first frequency through the long connection, the heartbeat packet comprising a user identifier of the user account; The second server acquires the user identifier comprised in the heartbeat packet upon receiving the heartbeat packet sent by the client through the long connection, and stores the correspondence between the user identifier and a heartbeat time as to-be-processed data in a preset distributed database, the heartbeat time being the time of receiving the heartbeat packet; The first server receives an interactive data display request of a client, and obtains a to-be-determined identifier carried in the interactive data display request; the to-be-determined identifier is a user identifier corresponding to interactive data included in a to-be-displayed data packet; The first server obtains user state data based on the correspondence between the user identifiers and the heartbeat times stored in the distributed database, and the user state data includes current connection states of different user accounts; Based on the user state data, a target identifier is determined from the to-be-determined identifier, and the target identifier is a user identifier corresponding to a user account in an online state; The target identifier is sent to the client; The client displays interactive data in the to-be-displayed data packet, and adds a specified mark to target interactive data in the display process, and the target interactive data is interactive data corresponding to the target identifier in the to-be-displayed data packet.
3. The method of claim 2, wherein, The server further includes a third server, and after the correspondence between the user identifiers and the heartbeat times is stored as to-be-processed data in a preset distributed database, the method further includes: The third server obtains to-be-processed data stored in the distributed database at a second frequency; The third server determines that the connection state of a user account corresponding to a user identifier in to-be-processed data is in an online state if a time difference between the heartbeat time in the to-be-processed data and the current time does not exceed a preset time threshold, and determines the user identifier in the to-be-processed data as a to-be-screened identifier; The third server constructs a Bloom filter and stores the to-be-screened identifier in the Bloom filter; The first server obtains user state data based on the correspondence between the user identifiers and the heartbeat times stored in the distributed database, including that the first server obtains a Bloom filter through the third server to obtain user state data based on to-be-screened identifiers stored in the Bloom filter; The determination of the target identifier from the to-be-determined identifier based on the user state data includes: Filtering the to-be-determined identifier based on the to-be-screened identifiers stored in the Bloom filter to obtain the target identifier.
4. The method of claim 3, wherein, After the third server constructs the Bloom filter, the method further includes: The third server uploads the constructed Bloom filter to a cloud storage space at the second frequency, and deletes the constructed Bloom filter in the third server; The first server obtains a Bloom filter from the cloud storage space at a third frequency and stores it in a preset cache; The first server obtains the Bloom filter through the third server, including that the first server reads the stored Bloom filter from the preset cache.
5. The method of claim 3, wherein, Before receiving the interactive data display request of the client, the method further includes: The third server adds the user identifier of the user account to a display account set when receiving a state display request sent by any user account; the display account set includes user identifiers of user accounts allowed to display connection states; The method further includes: The user identifier in the to-be-processed data is determined as a to-be-screened identifier when the user identifier in the to-be-processed data belongs to the display account set.
6. The method of claim 2, wherein, After the long connection is established with the client, the method further includes: The second server acquires a user identifier carried in the disconnection request as a disconnection identifier when receiving a disconnection request sent by the client through the long connection; The to-be-processed data in which the disconnection identifier is located is deleted from the distributed database.
7. An interactive data presentation method, characterized by, The method is applied to a client, and the method includes: A heartbeat packet is sent to a second server in a server through a long connection at a first frequency, the heartbeat packet including a user identifier of a user account; the second server is configured to acquire the user identifier included in the heartbeat packet when receiving the heartbeat packet sent by the client through the long connection, and store a correspondence between the user identifier and a heartbeat time as to-be-processed data in a preset distributed database, the heartbeat time being a time at which the heartbeat packet is received; the long connection is established by the second server when receiving a service access request sent by any user account through the client; In response to an interactive data display operation of a user, a to-be-displayed data packet corresponding to the interactive data display operation is acquired; A user identifier corresponding to interactive data included in the to-be-displayed data packet is acquired as a to-be-determined identifier, and an interactive data display request including the to-be-determined identifier is generated; The interactive data display request is sent to a server; the server further includes a first server; the first server is configured to receive the interactive data display request; In a case where a target identifier returned by the server in response to the interactive data display request is received, interactive data included in the to-be-displayed data packet is displayed, and a specified mark is added to target interactive data corresponding to the target identifier in the display process, the target interactive data being interactive data corresponding to the target identifier in the to-be-displayed data packet; The target identifier is determined by the server from to-be-determined identifiers based on user state data; the target identifier is a user identifier of a user account in an online state; the to-be-determined identifier is a user identifier corresponding to interactive data included in the to-be-displayed data packet and determined by the server from the interactive data display request; the user state data is acquired by the first server based on a correspondence between the user identifier and the heartbeat time stored in the distributed database; and the user state data includes current connection states of different user accounts.
8. An interactive data presentation system characterized by, The system includes a server and a client, and a first server receives an interactive data display request of the client; The client is configured to acquire a to-be-presented data packet corresponding to the interactive data presentation operation in response to a user interactive data presentation operation. The client is further configured to acquire a user identifier corresponding to the interactive data in the to-be-presented data packet as a to-be-determined identifier, generate an interactive data presentation request containing the to-be-determined identifier, and send the interactive data presentation request to the server. The first server is configured to receive the interactive data presentation request of the client. The second server is configured to establish a long connection with the client upon receiving a service access request sent by any user account through the client. The client is further configured to send a heartbeat packet to the second server at a first frequency through the long connection, the heartbeat packet containing a user identifier of the user account. The second server is further configured to acquire the user identifier contained in the heartbeat packet upon receiving the heartbeat packet sent by the client through the long connection, and store a correspondence between the user identifier and a heartbeat time, which is a time of receiving the heartbeat packet, in a preset distributed database as to-be-processed data. The server is configured to acquire the to-be-determined identifier carried in the interactive data presentation request, the to-be-determined identifier being a user identifier corresponding to the interactive data contained in the to-be-presented data packet. The first server is further configured to acquire user state data based on the correspondence between the user identifier and the heartbeat time stored in the distributed database, the user state data including current connection states of different user accounts. The server is further configured to determine a target identifier from the to-be-determined identifier based on the user state data, the target identifier being a user identifier corresponding to a user account in an online state. The server is further configured to send the target identifier to the client. The client is further configured to present the interactive data in the to-be-presented data packet and add a specified mark to target interactive data in a presentation process, the target interactive data being interactive data corresponding to the target identifier in the to-be-presented data packet.
9. An interactive data presentation device, characterized by The device is applied to a server, the server including a first server and a second server; and the device includes: A receiving module is configured to receive an interactive data presentation request of a client, acquire a to-be-determined identifier carried in the interactive data presentation request, and acquire user state data, the to-be-determined identifier being a user identifier corresponding to interactive data contained in a to-be-presented data packet, and the user state data including current connection states of different user accounts. A determining module is configured to determine a target identifier from the to-be-determined identifier based on the user state data, the target identifier being a user identifier corresponding to a user account in an online state. A sending module is configured to send the target identifier to the client, the client being configured to present interactive data in the to-be-presented data packet and add a specified mark to target interactive data in a presentation process, the target interactive data being interactive data corresponding to the target identifier in the to-be-presented data packet. The connection establishment module is configured to establish a long connection with the client by the second server when the second server receives a service access request sent by any user account through the client. The identification obtaining module is configured to obtain the user identification included in the heartbeat packet and store the correspondence between the user identification and the heartbeat time as to-be-processed data in a preset distributed database when the second server receives the heartbeat packet sent by the client through the long connection, wherein the heartbeat time is the time when the heartbeat packet is received. The receiving module is specifically configured to obtain user state data based on the correspondence between the user identification and the heartbeat time stored in the distributed database by the first server. The receiving module is specifically configured to receive an interactive data display request of the client by the first server.
10. An interactive data presentation device, characterized by The apparatus applied to the client comprises: The data packet obtaining module is configured to obtain a to-be-displayed data packet corresponding to an interactive data display operation of a user in response to the interactive data display operation, and send a heartbeat packet containing a user identification of a user account to a second server in a server through a long connection at a first frequency, wherein the second server is configured to obtain the user identification included in the heartbeat packet and store the correspondence between the user identification and a heartbeat time as to-be-processed data in a preset distributed database when the second server receives the heartbeat packet sent by the client through the long connection, wherein the heartbeat time is the time when the heartbeat packet is received, and the long connection is established by the second server when the second server receives a service access request sent by any user account through the client. The request generating module is configured to obtain a user identification corresponding to interactive data in the to-be-displayed data packet as a to-be-determined identification, and generate an interactive data display request containing the to-be-determined identification. The request sending module is configured to send the interactive data display request to the server, wherein the server further comprises a first server, and the first server is configured to receive the interactive data display request. The display module is configured to display the interactive data included in the to-be-displayed data packet when the display module receives a target identification returned by the server in response to the interactive data display request, and add a specified mark to target interactive data corresponding to the target identification in the display process, wherein the target interactive data is interactive data corresponding to the target identification in the to-be-displayed data packet. The target identifier is determined by the server based on user state data from the to-be-determined identifier; the target identifier is a user identifier corresponding to a user account in an online state; the to-be-determined identifier is determined by the server from the interactive data display request, and the to-be-determined identifier is a user identifier corresponding to interactive data contained in the to-be-displayed data packet; the user state data is obtained by the first server based on the correspondence between the user identifier and the heartbeat time stored in the distributed database, and the user state data includes the current connection state of different user accounts.
11. An electronic device, comprising: The device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. The memory is used for storing a computer program. The processor is used for executing the program stored on the memory to realize the method in any one of claims 1-7.
12. A computer readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to realize the method in any one of claims 1-7.
Citation Information
Patent Citations
Information display method, server, terminal and storage medium
CN111209417A
Recommendation information display method and device, and equipment
CN111753220A