Method, apparatus, electronic device, and storage medium for processing a communication session
By using the dynamically generated timestamp cardinality between the client and the server for session identification and verification, the problem of low security and accuracy of session-based data communication in the prior art is solved, and higher security and accuracy are achieved.
Patent Information
- Application Number
- CN202211056292.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-31
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2042-08-31
AI Technical Summary
In the prior art, session-based data communication has low security and accuracy.
By obtaining the session communication request sent by the client, if the request does not contain the timestamp cardinality, a target session is established and a base timetamp cardinality is generated; if the request contains the timestamp cardinality, a timetamp verification is performed to determine the target timestamp cardinality, and data communication with the client based on the session.
By using the dynamically changing timestamp cardinality as the session index, the uniqueness of session recognition is ensured and the security and accuracy of data communication are improved.
Smart Images

Figure CN115549916B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network and security technologies, and particularly to a method for processing a communication session, an apparatus for processing a communication session, an electronic device, and a computer-readable storage medium. Background Art
[0002] In the process of information transmission on the Internet, the communication between the client and the server is implemented based on the HTTP protocol (Hyper Text Transfer Protocol). As an application layer transmission protocol, the HTTP protocol is actually a stateless protocol. Initially, it was only used to obtain content on the web page. When the content acquisition is completed, it means that the session ends, and subsequent interactions do not need to be considered. With the rapid development of Internet technology, various services closely related to people's lives, such as the most basic food, clothing, housing, and transportation, have gradually completed the transformation from offline to online. For this "offline-online" transformation, on the one hand, it greatly facilitates people's lives and improves people's work efficiency and quality of life. On the other hand, it also increases people's demand for interaction scenarios. Therefore, in the face of the increasing demand for interaction, session tracking technologies suitable for online interaction scenarios have gradually emerged in people's vision.
[0003] Currently, traditional session tracking methods include: Cookie (data stored on the user's local terminal), URL (Uniform Resource Locator) rewriting, Session (session control), Token (token). Each of these methods has its own advantages and disadvantages. The Cookie method is relatively convenient and simple, but only supports ASCII character form; the URL rewriting method is relatively accurate, but it is very easy to expose the user ID; the Session method can store the data of multiple requests for one session, but it is not applicable to distributed systems; and as the current mainstream method, Token needs to insert a token in the request every time there is an interaction, which is likely to cause the request to be intercepted during the data communication process, resulting in low security. Summary of the Invention
[0004] Embodiments of the present invention provide a method, an apparatus, an electronic device, and a computer-readable storage medium for processing a communication session, so as to solve the problems of low security and accuracy of session-based data communication in the prior art.
[0005] Embodiments of the present invention disclose a method for processing a communication session, including:
[0006] Obtain a session communication request sent by the client;
[0007] If no timestamp base is included in the session communication request, establish a first target session corresponding to the session communication request and generate a first reference timestamp base for the first target session;
[0008] If a requested timestamp base is included in the session communication request, obtain the request time corresponding to the session communication request and the response time for responding to the session communication request, and perform timestamp verification on the requested timestamp base according to the request time and the response time to obtain a target timestamp base corresponding to the session communication request;
[0009] Use the session to which the second reference timestamp base corresponding to the target timestamp base belongs as the second target session corresponding to the session communication request;
[0010] Perform data communication with the client based on the first target session or the second target session.
[0011] Optionally, the performing timestamp verification on the requested timestamp base according to the request time and the response time to obtain a target timestamp base corresponding to the session communication request includes:
[0012] Calculate the time difference between the request time and the response time to generate a first time increment;
[0013] Calculate the time difference between the first time increment and the requested timestamp base to generate a target timestamp base corresponding to the session communication request.
[0014] Optionally, the using the session to which the second reference timestamp base corresponding to the target timestamp base belongs as the second target session corresponding to the session communication request includes:
[0015] Obtain a set of session time information, where the set of session time information includes the session establishment time and the reference timestamp base corresponding to each session;
[0016] Calculate the response time difference corresponding to each session by calculating the time difference between the session establishment time corresponding to each session and the response time;
[0017] Calculate the timestamp base difference corresponding to each session by calculating the time difference between the response time difference corresponding to each session and the target timestamp base;
[0018] Use the reference timestamp base that is the same as the timestamp base difference as the second reference timestamp base, and use the session to which the second reference timestamp base belongs as the second target session corresponding to the session communication request.
[0019] Optionally, the method further includes:
[0020] If there is no reference timestamp base in the session time information set that is the same as the timestamp base difference, establish a third target session corresponding to the session communication request, and perform data communication with the client based on the third target session;
[0021] Obtain the session establishment time of the third target session and the third reference timestamp base, and send the session establishment time of the third target session and the third reference timestamp base to the client.
[0022] Optionally, the method further includes:
[0023] Use the response time as the session establishment time of the second target session, and use the target timestamp base as the second reference timestamp base of the second target session;
[0024] Return the session establishment time of the second target session and the second reference timestamp base to the client.
[0025] Optionally, the session time information set further includes a timing value corresponding to each session, and the timing value is used to represent the storage time counted from the session establishment. The method further includes:
[0026] Use the session with the timing value greater than or equal to the preset timeout threshold as the fourth target session, end the fourth target session, and delete the session establishment time and the fourth reference timestamp base corresponding to the fourth target session from the session time information set.
[0027] Optionally, after establishing the first target session corresponding to the session communication request and generating the first reference timestamp base for the first target session, the method further includes:
[0028] Obtain the session establishment time of the first target session, and send the session establishment time of the first target session and the first reference timestamp base to the client.
[0029] An embodiment of the present invention also discloses a method for processing a communication session, including:
[0030] In response to a session request operation, if the session request operation is an operation to establish a session for the first time, generate a first session communication request corresponding to the session request operation, and send the first session communication request to the server, so that the server establishes a first target session based on the first session communication request;
[0031] If the session request operation is an operation to establish a session other than for the first time, obtain the request time and the request timestamp base number corresponding to the session request operation, and generate a second session communication request corresponding to the session request operation by using the request time and the request timestamp base number;
[0032] Send the second session communication request to the server, so that the server establishes a second target session based on the second session communication request;
[0033] Perform data communication with the server based on the first target session or the second target session.
[0034] Optionally, the step of, if the session request operation is an operation to establish a session other than for the first time, obtaining the request time and the request timestamp base number corresponding to the session request operation, and generating a second session communication request corresponding to the session request operation by using the request time and the request timestamp base number includes:
[0035] If the session request operation is an operation to establish a session other than for the first time, obtain the request time corresponding to the session request operation, and at the same time, find the second target session corresponding to the session request operation, and obtain the local session establishment time and the local reference timestamp base number corresponding to the second target session;
[0036] Calculate the time difference between the request time and the local session establishment time to obtain a second time increment;
[0037] Calculate the time difference between the second time increment and the local reference timestamp base number to generate a request timestamp base number corresponding to the request time;
[0038] Generate a second session communication request corresponding to the session request operation by using the request time and the request timestamp base number.
[0039] Optionally, after sending the first session communication request to the server, the method further includes:
[0040] Receive the session establishment time and the first reference timestamp base number of the first target session sent by the server;
[0041] Store the session establishment time of the first target session and the first reference timestamp base number.
[0042] Optionally, after sending the second session communication request to the server, the method further includes:
[0043] Obtaining a target session establishment time and a target reference timestamp base number corresponding to the second target session sent by the server, where the target session establishment time is the response time of the server to the second session communication request, and the target reference timestamp base number is the timestamp base number obtained by the server after updating the reference timestamp base number of the second target session according to the response time;
[0044] Updating the local reference timestamp base number to the target timestamp base number, and updating the local session establishment time to the target session establishment time.
[0045] Optionally, the method further includes:
[0046] If the server fails to find the second target session based on the second session communication request, establishing a third target session corresponding to the server, where the third target session is a new session established by the server according to the second session communication request;
[0047] Receiving the session establishment time and the third reference timestamp base number of the third target session sent by the server;
[0048] Storing the session establishment time of the third target session and the third reference timestamp base number.
[0049] An embodiment of the present invention also discloses a processing device for communication sessions, where the device includes:
[0050] A session communication request acquisition module, configured to acquire a session communication request sent by a client;
[0051] A first target session establishment module, configured to establish a first target session corresponding to the session communication request and generate a first reference timestamp base number for the first target session if no timestamp base number is included in the session communication request;
[0052] A target timestamp base number generation module, configured to obtain a request time corresponding to the session communication request and a response time for responding to the session communication request if a request timestamp base number is included in the session communication request, and perform timestamp verification on the request timestamp base number according to the request time and the response time to obtain a target timestamp base number corresponding to the session communication request;
[0053] A second target session determination module, configured to use the session to which the second reference timestamp base corresponding to the target timestamp base belongs as the second target session corresponding to the session communication request;
[0054] A data communication module, configured to perform data communication with the client based on the first target session or the second target session.
[0055] Optionally, the target timestamp base generation module is specifically configured to:
[0056] Calculate the time difference between the request time and the response time to generate a first time increment;
[0057] Calculate the time difference between the first time increment and the request timestamp base to generate a target timestamp base corresponding to the session communication request.
[0058] Optionally, the second target session determination module includes:
[0059] A session time information set acquisition module, configured to acquire a session time information set, where the session time information set includes the session establishment time and the reference timestamp base corresponding to each session;
[0060] A response time difference calculation module, configured to calculate the time difference between the session establishment time corresponding to each session and the response time to obtain the response time difference corresponding to each session;
[0061] A timestamp base difference calculation module, configured to calculate the time difference between the response time difference corresponding to each session and the target timestamp base to obtain the timestamp base difference corresponding to each session;
[0062] A second reference timestamp base determination module, configured to use the reference timestamp base with the same timestamp base difference as the second reference timestamp base, and use the session to which the second reference timestamp base belongs as the second target session corresponding to the session communication request.
[0063] Optionally, the apparatus further includes:
[0064] A third target session establishment module, configured to establish a third target session corresponding to the session communication request if there is no reference timestamp base with the same timestamp base difference in the session time information set, and perform data communication with the client based on the third target session;
[0065] A third target session sending module, configured to acquire the session establishment time and the third reference timestamp base of the third target session, and send the session establishment time and the third reference timestamp base of the third target session to the client.
[0066] Optionally, the device further includes:
[0067] A second target session update module, configured to use the response time as the session establishment time of the second target session, and use the target timestamp base as the second reference timestamp base of the second target session;
[0068] A second target session sending module, configured to return the session establishment time of the second target session and the second reference timestamp base to the client.
[0069] Optionally, the session time information set further includes a timing value corresponding to each session, where the timing value is used to represent the storage time counted from the session establishment, and the device further includes:
[0070] A session timeout processing module, configured to use the session with the timing value greater than or equal to a preset timeout threshold as a fourth target session, end the fourth target session, and delete the session establishment time and the fourth reference timestamp base corresponding to the fourth target session from the session time information set.
[0071] Optionally, the device further includes:
[0072] A first target session sending module, configured to obtain the session establishment time of the first target session, and send the session establishment time of the first target session and the first reference timestamp base to the client.
[0073] An embodiment of the present invention further discloses a processing device for communication sessions, where the device includes:
[0074] A first session communication request generation module, configured to, in response to a session request operation, if the session request operation is an operation for establishing a session for the first time, generate a first session communication request corresponding to the session request operation, and send the first session communication request to a server, so that the server establishes a first target session based on the first session communication request;
[0075] A second session communication request generation module, configured to, if the session request operation is an operation for establishing a session other than for the first time, obtain a request time and a request timestamp base corresponding to the session request operation, and generate a second session communication request corresponding to the session request operation by using the request time and the request timestamp base;
[0076] A second session communication request sending module, configured to send the second session communication request to the server, so that the server establishes a second target session based on the second session communication request;
[0077] A data communication module, configured to perform data communication with the server based on the first target session or the second target session.
[0078] Optionally, the second session communication request generation module includes:
[0079] A request time acquisition module, configured to, if the session request operation is not an operation for establishing a session for the first time, acquire the request time corresponding to the session request operation, and at the same time search for the second target session corresponding to the session request operation, and acquire the local session establishment time and the local reference timestamp base corresponding to the second target session;
[0080] A second time increment acquisition module, configured to calculate the time difference between the request time and the local session establishment time to obtain a second time increment;
[0081] A request timestamp base generation module, configured to calculate the time difference between the second time increment and the local reference timestamp base to generate a request timestamp base corresponding to the request time;
[0082] A second session communication request generation sub-module, configured to use the request time and the request timestamp base to generate a second session communication request corresponding to the session request operation.
[0083] Optionally, the device further includes:
[0084] A first target session reception module, configured to receive the session establishment time and the first reference timestamp base of the first target session sent by the server;
[0085] A first target session storage module, configured to store the session establishment time of the first target session and the first reference timestamp base.
[0086] Optionally, the device further includes:
[0087] A second target session acquisition module, configured to acquire the target session establishment time and the target reference timestamp base corresponding to the second target session sent by the server, where the target session establishment time is the response time of the server to the second session communication request, and the target reference timestamp base is the timestamp base obtained by the server after updating the reference timestamp base of the second target session according to the response time;
[0088] A local time information storage module, configured to update the local reference timestamp base to the target timestamp base, and update the local session establishment time to the target session establishment time.
[0089] Optionally, the device further includes:
[0090] A third target session establishment module, configured to establish a third target session corresponding to the server if the server fails to find the second target session based on the second session communication request, where the third target session is a new session established by the server according to the second session communication request;
[0091] A third target session receiving module, configured to receive the session establishment time of the third target session and the third reference timestamp base number sent by the server;
[0092] A third target session storage module, configured to store the session establishment time of the third target session and the third reference timestamp base number.
[0093] An embodiment of the present invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus;
[0094] The memory is used to store a computer program;
[0095] When the processor is configured to execute the program stored in the memory, it implements the method as described in the embodiment of the present invention.
[0096] An embodiment of the present invention also discloses a computer-readable storage medium, on which instructions are stored. When executed by one or more processors, the instructions cause the processors to execute the method as described in the embodiment of the present invention.
[0097] The embodiment of the present invention has the following advantages:
[0098] In the embodiment of the present invention, for the data communication process, by obtaining the session communication request sent by the client, when the session communication request does not contain a timestamp base number, the server can establish a new target session for the session communication request and randomly generate a reference timestamp base number corresponding to the target session. In the case where the session communication request sent by the client contains a timestamp base number, the server can also find the target session uniquely corresponding to the session communication request through the timestamp verification method according to the request timestamp base number in the session communication request, and realize data communication with the client based on the target session. Thus, by using the timestamp base number with dynamic change characteristics as the session index, the uniqueness of session identification is ensured, and the security and accuracy of the data communication process based on sessions are further improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0099] Figure 1 is a flowchart of the steps of a method for processing a communication session provided in an embodiment of the present invention;
[0100] Figure 2It is a flowchart of the steps of a method for processing a communication session provided in an embodiment of the present invention;
[0101] Figure 3 It is a schematic diagram of the process of a method for processing a communication session provided in an embodiment of the present invention;
[0102] Figure 4 It is a block diagram of the structure of a device for processing a communication session provided in an embodiment of the present invention;
[0103] Figure 5 It is a block diagram of the structure of a device for processing a communication session provided in an embodiment of the present invention;
[0104] Figure 6 It is a block diagram of an electronic device provided in an embodiment of the present invention. Detailed implementation manners
[0105] To make the above objects, features, and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific implementation manners.
[0106] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, some of the technical features involved in the embodiments of the present invention are explained and described below:
[0107] Session: When a user opens a browser, accesses multiple resources on a Web server, and then closes the browser, the whole process is called a session. A session can also be understood as a process of data interaction between the server and the client.
[0108] Session tracking: A method of maintaining user state (data), also known as session management. In the process of information transmission on the Internet, the communication between the client and the server is based on the HTTP protocol (Hyper Text Transfer Protocol). As an application layer transport protocol, the HTTP protocol is actually a stateless protocol. Each time the client sends a request to the server, the server will regard this request as a new request. In actual situations, the requests sent by the client to the server are not necessarily all new requests, and may also be requests for data interaction based on a previously established session. Therefore, session tracking technology is needed to maintain the state. In the present invention, relying on a high-precision atomic clock time system and using the time stamp base at the microsecond level as the session index, session tracking and identification can be achieved during the data interaction process.
[0109] Atomic clock: A timing device with an accuracy that can reach an error of only 1 second every 20 million years.
[0110] Timestamp base: Each generation or update of a piece of data has its corresponding unique time mark, which is the timestamp base. It can indicate when the piece of data was generated or changed, and no one can tamper with it. The timestamp base can also be expressed as the time key corresponding to each operation related to data in the session-based data interaction process. Correspondingly, the reference timestamp base can be expressed as the timestamp base corresponding to the session establishment time.
[0111] Key value: The key value is at the end of the registry structure chain and contains the actual configuration information and data used when the current computer and application are running. In the session-based data communication process, the session establishment time corresponding to the session and the reference timestamp base can be stored in the registry related to the session in the form of a set of key-value pairs, such as setting a session time information set for easy search and call.
[0112] Index: A decentralized storage structure created to accelerate the retrieval of data rows in a table. The index is established for the table and consists of index pages outside the data pages. Each row in the index page contains a logical pointer to accelerate data retrieval. Therefore, in the session-based data communication process, the timestamp base can be used as the session index to reduce the search time for session-related data and speed up the retrieval speed.
[0113] Cookie (data stored on the user's local terminal): A small piece of text data not exceeding 4KB, consisting of a name, a value, and several other optional attributes used to control the validity period, security, and scope of use of the Cookie. It can be understood as data (usually encrypted) stored on the client by some websites to identify users and track sessions, and is information temporarily or permanently saved by the client.
[0114] URL (Uniform Resource Locator): The address of a standard resource on the Internet. Each file on the Internet has a unique URL, which contains information pointing to the location of the file and indicating how the browser should process it. URL rewriting is the process of obtaining an incoming URL request and then rewriting it into another URL that the website can process.
[0115] Session (Time Domain): In network applications, also known as "session control", it refers to the time interval during which a terminal user communicates with an interactive system, usually referring to the time elapsed from registering and entering the system to logging out and exiting the system. SessionID is the user ID corresponding to the Session. The SessionID is stored in the server memory. It can track the user's conversation and is generated when the user first links to the website. The sessionID is set in the session cookie. In the browser, if multiple web pages coexist, they will share the same sessionID.
[0116] Token (Marker): A token, an object representing the right to perform certain operations, is a special frame that can control a site's access to the media, differentiating it from data frames and other control frames.
[0117] ASCII (American Standard Code for Information Interchange): A set of computer encoding systems based on the Latin alphabet, mainly used to display modern English and other Western European languages. So far, ASCII has defined 128 characters and is the most common information exchange standard.
[0118] As an example, with the rapid development of Internet technology, various services closely related to people's lives, such as the most basic food, clothing, housing, and transportation, have gradually completed the transformation from offline to online. For this "offline-online" transformation, on the one hand, it has greatly facilitated people's lives, improved people's work efficiency and quality of life, and on the other hand, it has also increased people's demand for interactive scenarios. Therefore, in the face of the increasing interactive demands, session tracking technologies suitable for online interactive scenarios have gradually emerged in people's vision. When using traditional session tracking methods, such as using the Cookie method, although it is relatively convenient and simple, it only supports ASCII character forms. When using the URL rewriting method, although it is relatively accurate, the user ID is extremely likely to be exposed during the session tracking process, easily causing information leakage and posing a security risk. When using the Session method, although it can store the data of multiple requests in one session, it is not applicable to distributed systems. If the current mainstream Token method is used, a marker needs to be inserted into the request during each interaction, which is likely to cause the request to be intercepted during data communication and has low security.
[0119] One of the core inventive points of the embodiments of the present invention lies in: for the data communication process, by using the timestamp base with dynamic change characteristics as the session index, the uniqueness of session identification in the data communication process is ensured, further improving the security and accuracy of session-based data communication. Moreover, the entire process does not rely on Cookies, and session-based data communication can be achieved even in the scenario where Cookies are disabled. In addition, the method of synchronizing high-precision timing between the client and the server is used to complete the identification and search of the session, realizing that only when session communication is required, the session time information related to the session is synchronized, thereby improving the timing accuracy of the timestamp base, reducing the calculation amount and transmission time, and there is no special requirement for the form of storing session time information, enabling session-based data communication to be applicable to different systems and further improving compatibility.
[0120] Referring to Figure 1 , a step flowchart of a method for processing a communication session provided in an embodiment of the present invention is shown, which may specifically include the following steps:
[0121] Step 101, obtain a session communication request sent by the client;
[0122] For the data interaction process, usually the client initiates a session communication request and sends it to the server. After receiving the session communication request, the server conducts data communication with the client. Therefore, before the server conducts session-based data communication with the client, it is necessary to obtain the session communication request sent by the client.
[0123] Step 102, if no timestamp base is included in the session communication request, establish a first target session corresponding to the session communication request, and generate a first reference timestamp base for the first target session;
[0124] After receiving the session communication request sent by the client, it is necessary to determine whether the session communication request includes a timestamp base. Assuming that no timestamp base is included, it means that the session communication request is a session communication request for the first session establishment operation initiated by the client, and no session has been initiated before or the session has ended and relevant interaction data has been deleted. Therefore, if no timestamp base is included in the session communication request, establish a first target session corresponding to the session communication request, and generate a first reference timestamp base for the first target session.
[0125] Generally speaking, the precision of traditional timestamps is 13 - bit milliseconds. To further improve the precision, the precision of the timestamp base can be set to 16 - bit microseconds, which is more precise than milliseconds. At the same time, the timestamp base can be dynamically generated in a way of randomly generating 16 - digit numbers. As an example, assume that a session communication request without any timestamp base is received. Then a new session is established for this session communication request, and a 16 - bit reference timestamp base corresponding to the established session is randomly generated. For example, if a new session is established at 9:58:57.200 seconds and 401 microseconds on Monday, July 26th, the randomly generated reference timestamp base can be (2192003481242183); another example, if a new session is established at 10:16:27.500 seconds and 301 microseconds on Tuesday, November 22nd, the randomly generated reference timestamp base can be (4122013321562684). Here, 1 second is equal to 1000 milliseconds, and 1 millisecond is equal to 1000 microseconds. Thus, when establishing a session, a high - precision timestamp base corresponding to the established session is dynamically generated randomly as the session index, greatly improving the uniqueness of session identification in the subsequent data communication process, thereby ensuring the accuracy and security of the data communication process based on sessions.
[0126] It should be noted that the above - listed examples are only for illustration. Since the generation method of the reference timestamp base is a random generation method and is uniquely corresponding to the establishment of the session, the obtained reference timestamp base should be subject to the actual generation.
[0127] As an alternative embodiment, after establishing the first target session corresponding to the session communication request and generating the first reference timestamp base for the first target session, the session establishment time of the first target session may also be obtained, and the session establishment time of the first target session and the first reference timestamp base are sent to the client. As an example, assume that the reference timestamp base corresponding to the newly established session is (2192003481242183), then the session establishment time corresponding to this session is obtained, such as 9:58:57.200401 am on Monday, July 26th, denoted as (Mon Jul26 09:58:57 200 401), and the reference timestamp base (2192003481242183) corresponding to this newly established session and the session establishment time (Mon Jul 26 09:58:57 200 401) are sent to the client together; for another example, assume that the reference timestamp base corresponding to the newly established session is (4122013321562684), then the session establishment time corresponding to this session is obtained, such as 10:16:27.500301 am on Tuesday, November 22nd, denoted as (Tue Nov 22 10:16:27 500 301), and the reference timestamp base (4122013321562684) corresponding to this newly established session and the session establishment time (Tue Nov 22 10:16:27 500 301) are sent to the client together, and so on.
[0128] By sending the session establishment time and the reference timestamp base of the newly established target session to the client, the client can store them after receiving them, so that the client can initiate a session communication request again based on this target session in the future, thereby realizing data interaction between the two ends.
[0129] In addition, in addition to sending the session establishment time of the first target session and the first reference timestamp base to the client, the first reference timestamp base may also be stored as a session index, and at the same time, the session establishment time of the first target session and the first reference timestamp base are stored in the session time information set in the form of a key-value pair set, so that the target session to which the session index belongs can be quickly searched based on the session index in the future.
[0130] It should be noted that the examples listed above are only for illustration purposes. Those skilled in the art should be aware that for the timestamp base, the 16 - digit number it contains represents time information and has no association with the current time. The role of the timestamp base is equivalent to a time key related to session operations. In addition, the precision of the timestamp base can be set to more than 16 digits, and can also be set to insert a character identifier at the front of the randomly generated number as an authentication password to enhance the uniqueness of the timestamp base. Those skilled in the art can set the timestamp base according to the actual situation. In addition, the form of storing session time information is not limited to the key - value pair set method. Those skilled in the art can set different storage methods for different systems to store session time information to further improve compatibility, etc. The present invention does not limit this.
[0131] Step 103, if the session communication request contains a requested timestamp base, obtain the request time corresponding to the session communication request and the response time for responding to the session communication request, and perform timestamp verification on the requested timestamp base according to the request time and the response time to obtain a target timestamp base corresponding to the session communication request;
[0132] In another possible situation, the session communication request sent by the client contains a requested timestamp base. Then, obtain the request time corresponding to the session communication request and the response time for responding to the session communication request, and perform timestamp verification on the requested timestamp base according to the request time and the response time to obtain a target timestamp base corresponding to the session communication request. As an example, assume that the requested timestamp base included in the session communication request is (2192003482163015). Then, obtain the request time corresponding to the session communication request as (Mon Jul 26 09:58:58 121 233), and at the same time obtain the response time for responding to the session communication request as (Mon Jul 26 09:58:58 877 215); for another example, assume that the requested timestamp base included in the session communication request can be (4122013322473136). Then, obtain the request time corresponding to the session communication request as (Tue Nov 22 10:16:28 410 753), and at the same time obtain the response time for responding to the session communication request as (Tue Nov 22 10:16:28 924 452), and so on.
[0133] Further, perform timestamp verification on the request timestamp base according to the request time and the response time to obtain the target timestamp base corresponding to the session communication request. Specifically, it can be as follows: First, calculate the time difference between the request time and the response time to generate a first time increment. Then, calculate the time difference between the first time increment and the request timestamp base to generate the target timestamp base corresponding to the session communication request. For the above example, for the request timestamp base (2192003482163015), the process of generating the target timestamp base can be: First, calculate the time difference between the request time (Mon Jul 26 09:58:58 121 233) and the response time (Mon Jul 26 09:58:58 877 215). The response time value can be subtracted from the request time value to obtain the corresponding time increment of 755982. Then, add this time increment 755982 to the request timestamp base (2192003482163015) to generate the target timestamp base (2192003482918997) corresponding to the session communication request. Another example, for the request timestamp base (4122013322473136), the process of generating the target timestamp base can be: First, calculate the time difference between the request time (Tue Nov 22 10:16:28 410 753) and the response time (Tue Nov 22 10:16:28 924 452). The response time value can be subtracted from the request time value to obtain the corresponding time increment of 513699. Then, add this time increment 513699 to the request timestamp base (4122013322473136) to generate the target timestamp base (4122013322986835) corresponding to the session communication request, and so on.
[0134] In the process of generating the target timestamp base, the request timestamp base is verified through two time difference calculations to generate the target timestamp base. This not only improves the accuracy of verification but also generates a unique target timestamp base corresponding to it through the timestamp base used as the dynamic time key, ensuring the uniqueness of session identification and search, thereby further improving the security and accuracy of session-based data communication.
[0135] It should be noted that the above examples are only for illustration. In actual situations, as can be seen from the foregoing content, the precision of the timestamp base can exceed 16 digits, and there may be character identifiers inserted before the corresponding random numbers. Therefore, in the case where the request timestamp base is included in the session communication request, those skilled in the art can adopt the same or similar method as in this example according to the actual situation to obtain the target timestamp base corresponding to the session communication request, and the present invention places no restrictions on this.
[0136] Step 104: Use the session to which the second reference timestamp base corresponding to the target timestamp base belongs as the second target session corresponding to the session communication request.
[0137] After determining the target timestamp base, it is necessary to search for and match the corresponding target session at this time. That is to say, it is necessary to search for the second reference timestamp base corresponding to the determined target timestamp base, and use the session to which the second reference timestamp base belongs as the second target session corresponding to the session communication request.
[0138] Further, this step can specifically be as follows: First, obtain a set of session time information, which includes the session establishment time and the reference timestamp base corresponding to each session. As can be seen from the previous discussion, when a session is established, the session establishment time corresponding to the session establishment and the reference timestamp base can be stored in the set of session time information in the form of a key-value pair set. Then, when searching for the target session, the set of session time information storing the session establishment time and the reference timestamp base corresponding to each session can be obtained. As an example, assume that there are 4 sets of session establishment times and reference timestamp bases corresponding to sessions stored in the obtained set of session time information, which are the first group of sessions: "(2192003737262887)(Mon Jul 26 09:58:53 404 251)", the second group of sessions: "(2192003481242183)(Mon Jul 26 09:58:57 200 401)", the third group of sessions: "(2145043752662786)(Mon Jul 26 09:58:52 312 431)", and the fourth group of sessions: "(2132044122662442)(Mon Jul 26 10:58:41 433 512)".
[0139] Second, calculate the time difference using the session establishment time and the response time corresponding to each session to obtain the response time difference corresponding to each session. For example, the response time can be subtracted from the session establishment time to obtain the response time difference corresponding to the session. Assume that the response time corresponding to the target timestamp base is (Mon Jul 26 09:58:58 877 215). Then, calculate the time difference between the response time and the session establishment time of the above 4 groups of sessions respectively, and the response time differences corresponding to the sessions can be obtained as 5472964 for the first group of sessions, 1676814 for the second group of sessions, 6564784 for the third group of sessions, and 17443703 for the fourth group of sessions.
[0140] Next, calculate the time difference using the response time difference corresponding to each session and the target timestamp base number to obtain the timestamp base number difference corresponding to each session. For example, the target timestamp base number can be subtracted by the response time difference to obtain the timestamp base number difference corresponding to the session. Assuming that the target timestamp base number corresponding to the response time (Mon Jul 26 09:58:58 877 215) is (2192003482918997), then the target timestamp base number is used to calculate the time difference for the response time differences corresponding to the above 4 groups of sessions respectively, and the timestamp base number differences corresponding to the sessions can be obtained. Among them, the timestamp base number difference for the first group of sessions is 2192003477446033, the second group of sessions is 2192003481242183, the third group of sessions is 2192003476354213, and the fourth group of sessions is 2192003465475294.
[0141] Finally, use the reference timestamp base number that is the same as the timestamp base number difference as the second reference timestamp base number, and use the session to which the second reference timestamp base number belongs as the second target session corresponding to the session communication request. For example, the timestamp base number difference can be matched with the reference timestamp base number of the corresponding session in a traversal manner, and the target session can be found through the matching result. For example, match the timestamp base number difference 2192003477446033 of the first group of sessions obtained after the time difference calculation with the reference timestamp base number (2192003737262887) of the first group of sessions. The match fails, indicating that the first session is not the target session pointed to by the session communication request. Continue to match the next group of sessions. Match the timestamp base number difference 2192003481242183 of the second group of sessions obtained after the time difference calculation with the reference timestamp base number (2192003481242183) of the second group of sessions. The match is successful, indicating that the second session is exactly the target session pointed to by the session communication request. At this time, use this reference timestamp base number (2192003481242183) as the second reference timestamp base number, and use the session to which it belongs as the second target session corresponding to the session communication request, thus completing the tracking and finding of the target session.
[0142] During the process of finding the target session, based on the timestamp base number, use the reverse calculation method to restore the reference timestamp base number actually corresponding to the target timestamp base number, and determine the target session uniquely corresponding to the session communication request by traversing and matching in the session time information set.
[0143] It should be noted that the above - listed examples are only for illustration purposes. In fact, after matching the reference timestamp base with the same base as the target timestamp through traversal, the remaining unmatched session information can also be matched to enhance the reliability of the matching result. When the digital sequence of the timestamp base contains character identifiers, further verification can be carried out through methods such as character inspection and sequence matching. In addition, for the traversal matching method of the reference timestamp base, in addition to calculating the timestamp base differences of each session first and then matching them one by one with the reference timestamp base of the session as proposed in the above example, a method of calculating the timestamp base differences and matching the reference timestamp base in groups can also be adopted to determine the reference timestamp base to be searched. For example, first calculate the timestamp base difference of the first - group sessions and match it with the corresponding reference timestamp base. If it doesn't match, then calculate and match the session time information of the next - group sessions until the matching is successful, etc. The present invention does not limit this.
[0144] As an alternative embodiment, after determining the second - target session corresponding to the session communication request, the response time can be used as the session establishment time of the second - target session, and the target timestamp base can be used as the second reference timestamp base of the second - target session to update the session establishment time and the reference timestamp base of the second - target session. As an example, assume that the response time corresponding to the session communication request is (Mon Jul 26 09:58:58 877 215), the target timestamp base is (2192003482918997), the session establishment time of the matched target session is (MonJul26 09:58:57 200 401), and the second reference timestamp base is (2192003481242183). Then, the response time (Mon Jul 26 09:58:58 877 215) can be used to update the session establishment time (Mon Jul26 09:58:57 200 401) of the matched target session, so as to obtain the updated session establishment time (MonJul 26 09:58:58 877 215) of the second - target session. The target timestamp base (2192003482918997) is used to update the second reference timestamp base (2192003481242183), so as to obtain the updated second reference timestamp base (2192003482918997).
[0145] By updating the data of the reference timestamp base and the session establishment time, the time data related to the session in the data communication process is not static but dynamically updated as the data interaction progresses, thereby further enhancing the security of the data communication process based on sessions.
[0146] Further, after completing the data update of the second target session, the session establishment time of the updated second target session and the second base timestamp base can also be returned to the client. For example, the session establishment time (Mon Jul 26 09:58:58 877 215) of the updated second target session and the second base timestamp base (2192003482918997) are returned to the client, so that the client can synchronously update the corresponding session time information.
[0147] As an alternative embodiment, if there is no base timestamp base in the session time information set with the same difference from the timestamp base, a third target session corresponding to the session communication request is established, and data communication is performed with the client based on the third target session. After calculating the time difference of the base timestamp bases in the session time information set, if the target session cannot be matched by traversing, it means that there is no target session corresponding to the session communication request in the session time information set. At this time, a third target session corresponding to the session communication request can be newly created, and data communication is performed with the client based on the third target session. Thus, even if there is no target session corresponding to the session communication request, data communication can still be achieved with the client based on the newly created session. Since the establishment of the session and the generation of the base timestamp base have been described in detail above, they will not be elaborated here.
[0148] Further, the session establishment time of the third target session and the third base timestamp base can also be obtained and sent to the client, so that the client can store them, which is convenient for initiating a session communication request again based on the third target session later. Since the relevant processes have been described in detail above, they will not be elaborated here.
[0149] Similarly, the third base timestamp base can also be stored as a session index, and at the same time, the session establishment time of the third target session and the third base timestamp base are stored in the session time information set in the form of a key-value pair set, so that the target session to which the session index belongs can be quickly searched based on the session index hereafter.
[0150] To prevent the session from being continuously saved on the server side, a corresponding validity period can be set for the session, indicating that the client and the server need to interact within a specified time period. That is, a preset timeout threshold is set in advance, and the session survival time is monitored while the session is established. When it is detected that the session survival time is greater than or equal to the preset timeout threshold, the session time information stored in the session time information set is cleared, and the session ends.
[0151] As an alternative embodiment, the session time information set further includes a timing value corresponding to each session. The timing value is used to represent the storage time counted from the start of session establishment. Sessions with a timing value greater than or equal to a preset timeout threshold are regarded as fourth target sessions. The fourth target sessions are ended, and the session establishment time and the fourth reference timestamp base number corresponding to the fourth target sessions are deleted from the session time information set. As an example, the preset timeout threshold can be set to 5 seconds. Suppose there is a session established at 9:58:57.200401 am on Monday, July 26th in the session time information set, and the corresponding session establishment time of this session is (Mon Jul 26 09:58:57 200401). Then, starting from 0 at the time point (Mon Jul 26 09:58:57 200401), when the counted time is greater than or equal to 5 seconds, that is, when the time is (Mon Jul 26 09:59:02 200401), it indicates that the establishment period of this session has reached the session timeout time. Then, this session is ended, and the session establishment time and the reference timestamp base number corresponding to this session are deleted from the session time information set.
[0152] It should be noted that the above-listed examples are only for illustration. Those skilled in the art can set the preset timeout threshold according to the actual situation. For example, the timing unit can be set to seconds or milliseconds. In terms of the timing method of the session, it can be set to positive timing from 0 to the preset timeout threshold, or it can be set to reverse timing from the preset timeout threshold to 0, etc. The present invention does not limit this.
[0153] Step 105: Perform data communication with the client based on the first target session or the second target session.
[0154] After determining the target session corresponding to the session communication request, data communication can be performed with the client based on the target session. Specifically, data communication is performed with the client based on the first target session or the second target session.
[0155] It should be noted that the embodiments of the present invention include but are not limited to the above examples. It can be understood that those skilled in the art can also make settings according to actual needs under the guidance of the ideas of the embodiments of the present invention. The present invention does not limit this.
[0156] In an embodiment of the present invention, for the data communication process, by obtaining a session communication request sent by a client, when the session communication request does not contain a timestamp base number, the server can establish a new target session for the session communication request and randomly generate a reference timestamp base number corresponding to the target session. In the case where the session communication request sent by the client contains a timestamp base number, the server can also find the target session uniquely corresponding to the session communication request through a timestamp verification method according to the timestamp base number in the session communication request, and implement data communication with the client based on the target session. Thus, by using the timestamp base number with dynamic change characteristics as the session index, the uniqueness of session identification is ensured, and further the security and accuracy of the data communication process based on the session are improved.
[0157] Referring to Figure 2 , a step flowchart of a method for processing a communication session provided in an embodiment of the present invention is shown, which may specifically include the following steps:
[0158] Step 201, in response to a session request operation, if the session request operation is an operation for establishing a session for the first time, generate a first session communication request corresponding to the session request operation, and send the first session communication request to the server, so that the server establishes a first target session based on the first session communication request;
[0159] Specifically, in response to a session request operation, before sending a session communication request to the server, first determine whether the session request operation is an operation for establishing a session for the first time. If the session request operation is an operation for establishing a session for the first time, generate a first session communication request corresponding to the session request operation, and send the first session communication request to the server, so that the server establishes a first target session based on the first session communication request. It can be understood that based on the session request operation being an operation for establishing a session for the first time, the corresponding first session communication request does not include any timestamp base number nor the session establishment time corresponding to any session.
[0160] As an alternative embodiment, after sending the first session communication request to the server, the session establishment time of the first target session and the first reference timestamp base sent by the server may also be received, and the session establishment time of the first target session and the first reference timestamp base are stored. As an example, assume that the session time information corresponding to the first session communication request returned by the server is the reference timestamp base (2192003481242183) and the session establishment time (Mon Jul 26 09:58:57 200 401). Then, this session time information is received, and the reference timestamp base (2192003481242183) and the session establishment time (Mon Jul 26 09:58:57 200401) in the session time information are saved locally, so that a session communication request can be initiated to the server again based on this session time information in the future. For another example, the session time information corresponding to the first session communication request returned by the server is that the reference timestamp base is (4122013321562684) and the session establishment time (Tue Nov 22 10:16:27 500 301). Then, this session time information is received, and the reference timestamp base (4122013321562684) and the session establishment time (Tue Nov 22 10:16:27 500 301) in the session time information are saved locally, so that a session communication request can be initiated to the server again based on this session time information in the future, and so on.
[0161] It should be noted that the above-listed examples are only for illustration. In actual applications, the reference timestamp base returned by the server may be different from that in the above examples. For example, in addition to being a randomly generated pure digital sequence, the reference timestamp base may also be a combined sequence with a character identifier at the front or end of the digital sequence, etc. Those skilled in the art can set it according to the actual situation, and the present invention does not limit this.
[0162] Step 202, if the session request operation is an operation for establishing a session for non-first time, obtain the request time and the request timestamp base corresponding to the session request operation, and generate a second session communication request corresponding to the session request operation by using the request time and the request timestamp base;
[0163] In another possible case, the session request operation may be an operation for establishing a session for non-first time. Then, obtain the request time and the request timestamp base corresponding to the session request operation, and generate a second session communication request corresponding to the session request operation by using the request time and the request timestamp base.
[0164] When the session request operation is an operation for establishing a session for non - the first time, as an example, the second session communication request can be generated in the following way: First, obtain the request time corresponding to the session request operation. At the same time, search for the second target session corresponding to the session request operation, and obtain the local session establishment time and the local reference timestamp base corresponding to the second target session. For example, assume that the request time corresponding to the session request operation is (Mon Jul 26 09:58:58 121 233), then the target session corresponding to the session communication request operation can be searched for, and the corresponding local session establishment time (Mon Jul 26 09:58:57 200 401) and the local reference timestamp base (2192003481242183) can be obtained; for another example, assume that the request time corresponding to the session request operation is (Tue Nov 22 10:16:28 410 753), then the target session corresponding to the session communication request operation can be searched for, and the corresponding local session establishment time (Tue Nov 22 10:16:27 500301) and the local reference timestamp base (4122013321562684) can be obtained, and so on.
[0165] Then, calculate the time difference between the request time and the local session establishment time to obtain the second time increment, and calculate the time difference between the second time increment and the local reference timestamp base to generate the request timestamp base corresponding to the request time. Specifically, the request time can be subtracted from the local session establishment time to obtain the corresponding time increment, and this time increment can be added to the local reference timestamp base to obtain the request timestamp base corresponding to the request time. For example, subtracting the local session establishment time (Mon Jul 26 09:58:57 200 401) from the request time (Mon Jul 26 09:58:58 121 233), the corresponding time increment of 920832 can be obtained. Then, adding the time increment 920832 to the local reference timestamp base (2192003481242183), the request timestamp base (2192003482163015) is obtained; for another example, subtracting the local session establishment time (Tue Nov 22 10:16:27 500301) from the request time (Tue Nov 22 10:16:28 410 753), the corresponding time increment of 910452 can be obtained. Then, adding the time increment 910452 to the local reference timestamp base (4122013321562684), the request timestamp base (4122013322473136) is obtained, and so on.
[0166] Then, the request time and the request timestamp base are used to generate a second session communication request corresponding to the session request operation. For example, the request time (Mon Jul 26 09:58:58 121 233) and the request timestamp base (2192003482163015) are used to generate a session communication request corresponding to the session request operation; for another example, the request time (Tue Nov 22 10:16:28 410 753) and the request timestamp base (4122013322473136) are used to generate a session communication request corresponding to the session request operation, and so on.
[0167] In this alternative embodiment, when a session request operation needs to be initiated, based on the timestamp base, through a time difference calculation method, the local reference timestamp base and the local session establishment time stored locally are updated, and a request timestamp base corresponding to the session communication request is dynamically generated, so as to further improve the accuracy of the communication session on the basis of data communication based on the original session, and it is realized that only when a session request operation needs to be initiated, the session time information related to the session is synchronously updated, thereby improving the timing accuracy of the timestamp base, reducing the calculation amount and the transmission time consumption.
[0168] It should be noted that the above-listed examples are only for illustration. In practical applications, in addition to the request time and the request timestamp base, the session communication request may further include other instructions related to the session request operation, etc. Those skilled in the art can set the content and generation method of the session communication request according to the actual situation, and the present invention does not limit this.
[0169] Step 203, send the second session communication request to the server, so that the server establishes a second target session based on the second session communication request;
[0170] Specifically, the second session communication request can be sent to the server, so that the server establishes a second target session based on the second session communication request.
[0171] As an alternative embodiment, after sending the second session communication request to the server, it is also possible to obtain the target session establishment time and the target reference timestamp base corresponding to the second target session sent by the server. The target session establishment time is the response time of the server to the second session communication request, and the target reference timestamp base is the timestamp base obtained after the server updates the reference timestamp base of the second target session according to the response time. Then, update the local reference timestamp base to the target reference timestamp base and update the local session establishment time to the target session establishment time. As an example, assume that a session communication request containing a request time (Mon Jul 26 09:58:58 121 233) and a request timestamp base (2192003482163015) is sent to the server, and then obtain the session time information corresponding to this session communication request returned by the server, that is, the target session establishment time (Mon Jul 26 09:58:58 877 215) and the target reference timestamp base (2192003482918997) corresponding to the updated second target session. Further, update the local reference timestamp base from the previous (2192003481242183) to (2192003482918997), and update the local session establishment time from the previous (Mon Jul 26 09:58:57 200 401) to (Mon Jul 26 09:58:58 877 215), and store the updated local reference timestamp base (2192003482918997) and the local session establishment time (Mon Jul 26 09:58:58 877 215).
[0172] In another possible scenario, when the server fails to find the second target session based on the second session communication request, a third target session corresponding to the server is established. The third target session is a new session established by the server according to the second session communication request. Since the relevant process has been described in detail above, it will not be elaborated here.
[0173] Similarly, the client can also receive the session establishment time and the third reference timestamp base of the third target session sent by the server and store the session establishment time and the third reference timestamp base of the third target session. Since the relevant process has been described in detail above, it will not be elaborated here either.
[0174] Step 204, perform data communication with the server based on the first target session or the second target session.
[0175] After determining the target session corresponding to the session communication request, data communication can be performed with the server based on the target session. Specifically, data communication is performed with the server based on the first target session or the second target session.
[0176] It should be noted that the embodiments of the present invention include but are not limited to the above examples. It can be understood that those skilled in the art can also make settings according to actual needs under the guidance of the ideas of the embodiments of the present invention, and the present invention does not limit this.
[0177] In the embodiments of the present invention, for the data communication process, by obtaining the session communication request sent by the client, when the session communication request does not contain a timestamp base number, the server can establish a new target session for the session communication request and randomly generate a reference timestamp base number corresponding to the target session. In the case where the session communication request sent by the client contains a timestamp base number, the server can also find the target session uniquely corresponding to the session communication request through the timestamp verification method according to the timestamp base number in the session communication request, and realize data communication with the client based on the target session. Thus, by using the timestamp base number with dynamic change characteristics as the session index, the uniqueness of session identification is ensured, and the security and accuracy of the data communication process based on the session are further improved.
[0178] To enable those skilled in the art to better understand the technical solutions of the embodiments of the present invention, the following is explained and illustrated through an example:
[0179] Refer to Figure 3 , which shows a schematic flowchart of a method for processing a communication session provided in the embodiments of the present invention. Among them, in this example, it is exemplarily illustrated by taking the case where the client initiates a session communication request to the server for the first time and a session is established between the client and the server. The present invention does not limit this.
[0180] 1. The client initiates a session communication request to the server for the first time, and the session communication request does not include any timestamp base number.
[0181] 2. After the server receives the session communication request, it detects the session communication request. If it detects that the session communication request does not contain a timestamp base, it establishes a new session, obtains the session establishment time a (Mon Jul 26 09:58:57 200 401) corresponding to the established session, and simultaneously generates a 16-bit random number as the reference timestamp base a' (2192003481242183). It stores the reference timestamp base a' (2192003481242183) as the session index, and at the same time stores the reference timestamp base a' (2192003481242183) and the session establishment time a (Mon Jul 26 09:58:57 200 401) in the session time information set in the form of a key-value pair set. A preset timeout threshold, such as 10 seconds, can be set in advance. When establishing the session, monitor the session survival time. When it is detected that the session survival time is greater than or equal to the preset timeout threshold, clear the reference timestamp base a' (2192003481242183) and the session establishment time a (Mon Jul 26 09:58:57 200 401) of the session, and end the session.
[0182] 3. The server conducts data communication with the client based on the newly established session, and returns the reference timestamp base a' (2192003481242183) and the session establishment time a (Mon Jul 26 09:58:57 200 401) to the client as a response.
[0183] 4. After receiving the response information, the client saves the reference timestamp base a'(2192003481242183) and the session establishment time a(Mon Jul 26 09:58:57 200 401) locally on the client. When the client initiates a session communication request again, it is necessary to update the reference timestamp base a'(2192003481242183) and obtain the request time b(Mon Jul 26 09:58:58 121 233) corresponding to the session communication request. 401) to calculate the time difference, it can be concluded that the time increment of the base timestamp base a'(2192003481242183) is 920832, and then the time increment 920832 is added to the base timestamp base a'(2192003481242183) to obtain the request timestamp base b'(2192003482163015), and then the request time b(Mon Jul 26 09:58:58 121 233) and the request timestamp base b'(2192003482163015) are used to generate the second session communication request and send it to the server.
[0184] 5. The server receives the second session communication request sent by the client, obtains the request time b (Mon Jul 26 09:58:58 121 233) and the request timestamp base b' (2192003482163015) in the session communication request, then obtains the response time c (Mon Jul 26 09:58:58 877 215) in response to the session communication request, and calculates the time difference between the response time c and the request time b (Mon Jul 26 09:58:58 121 233) to obtain a time increment of 755982, and then adds the time increment of 755982 to the request timestamp base b' (2192003482163015) to obtain the target timestamp base c' (2192003482918997).
[0185] 6. Obtain the set of session time information stored on the server. Calculate the time difference between the session establishment time corresponding to each session in the set of session time information and the response time c (Mon Jul 26 09:58:58 877 215) to obtain the response time difference corresponding to each session. Then, calculate the time difference between the response time difference corresponding to each session and the target timestamp base c' (2192003482918997) to obtain the timestamp base difference corresponding to each session. Use a traversal method to match the timestamp base difference with the reference timestamp base of the corresponding session, and determine the target session based on the matching result.
[0186] 7. During the traversal process, assume that there is a reference timestamp base a' (2192003481242183) that matches the timestamp base difference. Then, it is determined that the match is successful, and the session to which the reference timestamp base belongs is determined as the target session. Next, use the response time c (Mon Jul 26 09:58:58 877 215) to update the session establishment time a (Mon Jul 26 09:58:57 200 401) corresponding to the target session, and use the target timestamp base c' (2192003482918997) to update the reference timestamp base a' (2192003481242183) of the target session. The server communicates with the client based on the target session after updating the session time information, and returns the updated session establishment time c (Mon Jul 26 09:58:58 877 215) and the reference timestamp base c' (2192003482918997) as the response result to the client.
[0187] 8. When, until the end of the traversal, a reference timestamp base that matches the timestamp base difference still cannot be found, it is determined that the match fails, and there is no target session corresponding to the second session communication request in the server. At this time, a new session for the second session communication request is created. The server communicates with the client based on the newly created session. The process of creating a new session can refer to the foregoing content and will not be elaborated here.
[0188] It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential for the embodiments of the present invention.
[0189] Refer to Figure 4, which shows a structural block diagram of a processing device for a communication session provided in an embodiment of the present invention, may specifically include the following modules:
[0190] A session communication request acquisition module 401, configured to acquire a session communication request sent by a client;
[0191] A first target session establishment module 402, configured to establish a first target session corresponding to the session communication request and generate a first reference timestamp base for the first target session if no timestamp base is included in the session communication request;
[0192] A target timestamp base generation module 403, configured to obtain a request time corresponding to the session communication request and a response time for responding to the session communication request if a requested timestamp base is included in the session communication request, and perform timestamp verification on the requested timestamp base according to the request time and the response time to obtain a target timestamp base corresponding to the session communication request;
[0193] A second target session determination module 404, configured to use the session to which the second reference timestamp base corresponding to the target timestamp base belongs as the second target session corresponding to the session communication request;
[0194] A data communication module 405, configured to perform data communication with the client based on the first target session or the second target session.
[0195] In an optional embodiment, the target timestamp base generation module 403 is specifically configured to:
[0196] Calculate a time difference between the request time and the response time to generate a first time increment;
[0197] Calculate a time difference between the first time increment and the requested timestamp base to generate a target timestamp base corresponding to the session communication request.
[0198] In an optional embodiment, the second target session determination module 404 includes:
[0199] A session time information set acquisition module, configured to acquire a session time information set, where the session time information set includes a session establishment time and a reference timestamp base corresponding to each session;
[0200] A response time difference calculation module, configured to calculate a time difference between the session establishment time corresponding to each session and the response time to obtain a response time difference corresponding to each session;
[0201] A timestamp base difference calculation module, configured to calculate a time difference by using the response time differences corresponding to each of the sessions and the target timestamp base, so as to obtain the timestamp base differences corresponding to each of the sessions;
[0202] A second reference timestamp base determination module, configured to use the reference timestamp base that is the same as the timestamp base difference as the second reference timestamp base, and use the session to which the second reference timestamp base belongs as the second target session corresponding to the session communication request.
[0203] In an alternative embodiment, the apparatus further includes:
[0204] A third target session establishment module, configured to, if there is no reference timestamp base that is the same as the timestamp base difference in the session time information set, establish a third target session corresponding to the session communication request, and perform data communication with the client based on the third target session;
[0205] A third target session sending module, configured to obtain the session establishment time of the third target session and a third reference timestamp base, and send the session establishment time of the third target session and the third reference timestamp base to the client.
[0206] In an alternative embodiment, the apparatus further includes:
[0207] A second target session update module, configured to use the response time as the session establishment time of the second target session, and use the target timestamp base as the second reference timestamp base of the second target session;
[0208] A second target session sending module, configured to return the session establishment time of the second target session and the second reference timestamp base to the client.
[0209] Optionally, the session time information set further includes a timing value corresponding to each session, where the timing value is used to represent the storage time counted from the start of session establishment. The apparatus further includes:
[0210] A session timeout processing module, configured to use the session with the timing value greater than or equal to a preset timeout threshold as a fourth target session, end the fourth target session, and delete the session establishment time and the fourth reference timestamp base corresponding to the fourth target session from the session time information set.
[0211] In an alternative embodiment, the apparatus further includes:
[0212] The first target session sending module is configured to obtain the session establishment time of the first target session and send the session establishment time of the first target session and the first reference timestamp base to the client.
[0213] Referring to Figure 5 , a structural block diagram of a communication session processing apparatus provided in an embodiment of the present invention is shown, which may specifically include the following modules:
[0214] The first session communication request generation module 501 is configured to, in response to a session request operation, if the session request operation is an operation for establishing a session for the first time, generate a first session communication request corresponding to the session request operation and send the first session communication request to the server, so that the server establishes a first target session based on the first session communication request;
[0215] The second session communication request generation module 502 is configured to, if the session request operation is an operation for establishing a session that is not the first time, obtain the request time and the request timestamp base corresponding to the session request operation, and generate a second session communication request corresponding to the session request operation by using the request time and the request timestamp base;
[0216] The second session communication request sending module 503 is configured to send the second session communication request to the server, so that the server establishes a second target session based on the second session communication request;
[0217] The data communication module 504 performs data communication with the server based on the first target session or the second target session.
[0218] In an alternative embodiment, the second session communication request generation module 502 includes:
[0219] The request time acquisition module is configured to, if the session request operation is an operation for establishing a session that is not the first time, obtain the request time corresponding to the session request operation, and at the same time search for a second target session corresponding to the session request operation, and obtain the local session establishment time and the local reference timestamp base corresponding to the second target session;
[0220] The second time increment acquisition module is configured to calculate the time difference between the request time and the local session establishment time to obtain a second time increment;
[0221] The request timestamp base generation module is configured to calculate the time difference between the second time increment and the local reference timestamp base to generate a request timestamp base corresponding to the request time;
[0222] The second session communication request generation sub-module is used to generate a second session communication request corresponding to the session request operation by using the request time and the request timestamp base number.
[0223] In an alternative embodiment, the apparatus further includes:
[0224] The first target session receiving module is used to receive the session establishment time of the first target session and the first reference timestamp base number sent by the server;
[0225] The first target session storage module is used to store the session establishment time of the first target session and the first reference timestamp base number.
[0226] In an alternative embodiment, the apparatus further includes:
[0227] The second target session obtaining module is used to obtain the target session establishment time corresponding to the second target session and the target reference timestamp base number sent by the server, where the target session establishment time is the response time of the server to the second session communication request, and the target reference timestamp base number is the timestamp base number obtained by the server after updating the reference timestamp base number of the second target session according to the response time;
[0228] The local time information storage module is used to update the local reference timestamp base number to the target timestamp base number, and update the local session establishment time to the target session establishment time.
[0229] In an alternative embodiment, the apparatus further includes:
[0230] The third target session establishment module is used to establish a third target session corresponding to the server if the server fails to find the second target session based on the second session communication request, where the third target session is a new session established by the server according to the second session communication request;
[0231] The third target session receiving module is used to receive the session establishment time of the third target session and the third reference timestamp base number sent by the server;
[0232] The third target session storage module is used to store the session establishment time of the third target session and the third reference timestamp base number.
[0233] For the apparatus embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For related parts, please refer to the partial description of the method embodiment.
[0234] In addition, an embodiment of the present invention further provides an electronic device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements each process of the embodiment of the above communication session processing method and can achieve the same technical effect. To avoid repetition, it will not be described herein again.
[0235] An embodiment of the present invention further provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by the processor, it implements each process of the embodiment of the above communication session processing method and can achieve the same technical effect. To avoid repetition, it will not be described herein again. Among them, the computer-readable storage medium includes, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc, etc.
[0236] Figure 6 FIG. is a schematic diagram of the hardware structure of an electronic device for implementing each embodiment of the present invention.
[0237] The electronic device 600 includes, but is not limited to: a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, a processor 610, and a power supply 611, etc. Those skilled in the art can understand that the structure of the electronic device involved in the embodiment of the present invention does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements. In the embodiment of the present invention, the electronic device includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a handheld computer, a vehicle-mounted terminal, a wearable device, and a pedometer, etc.
[0238] It should be understood that in the embodiment of the present invention, the radio frequency unit 601 can be used for receiving and sending signals during information reception or call processes. Specifically, after receiving the downlink data from the base station, it is given to the processor 610 for processing; in addition, the uplink data is sent to the base station. Usually, the radio frequency unit 601 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, etc. In addition, the radio frequency unit 601 can also communicate with the network and other devices through a wireless communication system.
[0239] The electronic device provides the user with wireless broadband Internet access through the network module 602, such as helping the user to send and receive emails, browse web pages, and access streaming media, etc.
[0240] The audio output unit 603 can convert the audio data received by the radio frequency unit 601 or the network module 602 or stored in the memory 609 into an audio signal and output it as sound. Moreover, the audio output unit 603 can also provide an audio output related to a specific function performed by the electronic device 600 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 603 includes a speaker, a buzzer, a receiver, etc.
[0241] The input unit 604 is used to receive an audio or video signal. The input unit 604 may include a Graphics Processing Unit (GPU) 6041 and a microphone 6042. The graphics processor 6041 processes the image data of a static picture or a video obtained by an image capturing device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 606. The image frame processed by the graphics processor 6041 can be stored in the memory 609 (or other storage media) or transmitted via the radio frequency unit 601 or the network module 602. The microphone 6042 can receive sound and can process such sound into audio data. The processed audio data can be output in a format that can be transmitted to a mobile communication base station via the radio frequency unit 601 in the case of a phone call mode.
[0242] The electronic device 600 further includes at least one sensor 605, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor. Among them, the ambient light sensor can adjust the brightness of the display panel 6061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 6061 and / or the backlight when the electronic device 600 is moved to the ear. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as a pedometer, tapping), etc.; the sensor 605 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be elaborated here.
[0243] The display unit 606 is used to display the information input by the user or the information provided to the user. The display unit 606 may include a display panel 6061, and the display panel 6061 can be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), etc.
[0244] The user input unit 607 can be used to receive input digital or character information and generate key signal inputs related to the user settings and function control of the electronic device. Specifically, the user input unit 607 includes a touch panel 6061 and other input devices 6072. The touch panel 6061, also known as a touch screen, can collect touch operations of the user on or near it (such as operations of the user using any suitable object or accessory such as a finger or a stylus on or near the touch panel 6061). The touch panel 6061 can include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch orientation of the user and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 610, and receives and executes the command sent by the processor 610. In addition, the touch panel 6061 can be implemented in multiple types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 6061, the user input unit 607 can also include other input devices 6072. Specifically, the other input devices 6072 can include but are not limited to a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated here.
[0245] Furthermore, the touch panel 6061 can cover the display panel 6061. After the touch panel 6061 detects a touch operation on or near it, it transmits the operation to the processor 610 to determine the type of touch event. Subsequently, the processor 610 provides a corresponding visual output on the display panel 6061 according to the type of touch event. It can be understood that in one embodiment, the touch panel 6061 and the display panel 6061 are implemented as two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 6061 and the display panel 6061 can be integrated to realize the input and output functions of the electronic device, and the specific implementation here is not limited.
[0246] The interface unit 608 is an interface for connecting an external device to the electronic device 600. For example, the external device can include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headset port, and so on. The interface unit 608 can be used to receive inputs from an external device (such as data information, power, etc.) and transmit the received inputs to one or more components within the electronic device 600 or can be used to transmit data between the electronic device 600 and the external device.
[0247] The memory 609 can be used to store software programs and various data. The memory 609 mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, phone book, etc.). In addition, the memory 609 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0248] The processor 610 is the control center of the electronic device, connecting various parts of the entire electronic device through various interfaces and circuits. By running or executing the software programs and / or modules stored in the memory 609, and by calling the data stored in the memory 609, it executes various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 610 may include one or more processing units; preferably, the processor 610 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor may not be integrated into the processor 610.
[0249] The electronic device 600 may also include a power source 611 (such as a battery) for powering each component. Preferably, the power source 611 can be logically connected to the processor 610 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system.
[0250] In addition, the electronic device 600 includes some functional modules not shown here and will not be elaborated further.
[0251] It should be noted that in this article, the term "including", "comprising", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such a process, method, article, or device. Without further limitations, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or device including that element.
[0252] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in various embodiments of the present invention.
[0253] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present invention, those of ordinary skill in the art can also make many forms without departing from the purpose of the present invention and the scope protected by the claims, and all of them belong to the protection scope of the present invention.
[0254] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in the embodiments of the present invention can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraint conditions of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0255] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be repeated here.
[0256] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some interfaces. The indirect coupling or communication connection of the devices or units can be in an electrical, mechanical, or other form.
[0257] The unit described as a separation component may or may not be physically separated. The component shown as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0258] In addition, each functional unit in various embodiments of the present invention may be integrated in a processing unit, may exist physically alone for each unit, or two or more units may be integrated in one unit.
[0259] If the above-mentioned function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical discs that can store program codes.
[0260] As described above, it is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, and all of them should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A method for processing a communication session, characterized in that, it includes: Obtaining a session communication request sent by a client; The session communication request is generated by the client in response to a session request operation for initially establishing a session, or in response to a session request operation for non-initially establishing a session, and is generated by using the request time corresponding to the session request operation and a request timestamp base; If no timestamp base is included in the session communication request, establish a first target session corresponding to the session communication request, and generate a first reference timestamp base for the first target session; If a request timestamp base is included in the session communication request, obtain the request time corresponding to the session communication request and the response time for responding to the session communication request, and perform timestamp verification on the request timestamp base according to the request time and the response time to obtain a target timestamp base corresponding to the session communication request; Use the session to which the second reference timestamp base corresponding to the target timestamp base belongs as the second target session corresponding to the session communication request; Perform data communication with the client based on the first target session or the second target session.
2. The method according to claim 1, characterized in that, The performing timestamp verification on the request timestamp base according to the request time and the response time to obtain a target timestamp base corresponding to the session communication request includes: Calculating the time difference between the request time and the response time to generate a first time increment; Calculating the time difference between the first time increment and the request timestamp base to generate a target timestamp base corresponding to the session communication request.
3. The method according to claim 1, characterized in that, The using the session to which the second reference timestamp base corresponding to the target timestamp base belongs as the second target session corresponding to the session communication request includes: Obtaining a session time information set, where the session time information set includes the session establishment time and the reference timestamp base corresponding to each session; Calculating the time difference between the session establishment time corresponding to each session and the response time to obtain the response time difference corresponding to each session; Calculating the time difference between the response time difference corresponding to each session and the target timestamp base to obtain the timestamp base difference corresponding to each session; Use the reference timestamp base with the same timestamp base difference as the second reference timestamp base, and use the session to which the second reference timestamp base belongs as the second target session corresponding to the session communication request.
4. The method according to claim 3, characterized in that, it further includes: If there is no reference timestamp base with the same timestamp base difference in the session time information set, establish a third target session corresponding to the session communication request, and perform data communication with the client based on the third target session; Obtain the session establishment time of the third target session and the third reference timestamp base number, and send the session establishment time of the third target session and the third reference timestamp base number to the client.
5. The method according to claim 1 or 3, wherein, further comprising: Regarding the response time as the session establishment time of the second target session, and regarding the target timestamp base number as the second reference timestamp base number of the second target session; Return the session establishment time of the second target session and the second reference timestamp base number to the client.
6. The method according to claim 3, wherein, The session time information set further includes a timing value corresponding to each session, and the timing value is used to represent the time counted from the start of session establishment. The method further comprises: Regarding the session with the timing value greater than or equal to the preset timeout threshold as the fourth target session, end the fourth target session, and delete the session establishment time and the fourth reference timestamp base number corresponding to the fourth target session from the session time information set.
7. The method according to claim 1, wherein, After establishing the first target session corresponding to the session communication request and generating the first reference timestamp base number for the first target session, the method further comprises: Obtain the session establishment time of the first target session, and send the session establishment time of the first target session and the first reference timestamp base number to the client.
8. A method for processing communication sessions, wherein, comprising: In response to a session request operation, if the session request operation is an operation for establishing a session for the first time, generate a first session communication request corresponding to the session request operation, and send the first session communication request to the server, so that the server establishes a first target session based on the first session communication request and generates a first reference timestamp base number for the first target session; wherein, the first session communication request does not include any timestamp base number; If the session request operation is an operation for establishing a session not for the first time, obtain the request time and the request timestamp base number corresponding to the session request operation, and generate a second session communication request corresponding to the session request operation by using the request time and the request timestamp base number; Send the second session communication request to the server, so that the server establishes a second target session based on the second session communication request; the second target session is the session to which the second reference timestamp base number corresponding to the target timestamp base number belongs; the target timestamp base number is obtained by performing timestamp verification on the request timestamp base number according to the request time corresponding to the second session communication request and the response time for responding to the second session communication request; Perform data communication with the server based on the first target session or the second target session.
9. The method according to claim 8, wherein, If the session request operation is an operation for establishing a session for non - first time, obtain the request time and the request timestamp base corresponding to the session request operation, and generate a second session communication request corresponding to the session request operation by using the request time and the request timestamp base, including: If the session request operation is an operation for establishing a session for non - first time, obtain the request time corresponding to the session request operation, and at the same time, search for a second target session corresponding to the session request operation, and obtain the local session establishment time and the local reference timestamp base corresponding to the second target session; Calculate the time difference between the request time and the local session establishment time to obtain a second time increment; Calculate the time difference between the second time increment and the local reference timestamp base to generate a request timestamp base corresponding to the request time; Generate a second session communication request corresponding to the session request operation by using the request time and the request timestamp base.
10. The method according to claim 8, wherein, after sending the first session communication request to the server, the method further includes: Receiving the session establishment time and the first reference timestamp base of the first target session sent by the server; Storing the session establishment time of the first target session and the first reference timestamp base.
11. The method according to claim 9, wherein, after sending the second session communication request to the server, the method further includes: Obtaining the target session establishment time and the target reference timestamp base corresponding to the second target session sent by the server, where the target session establishment time is the response time of the server to the second session communication request, and the target reference timestamp base is the timestamp base obtained after the server updates the reference timestamp base of the second target session according to the response time; Updating the local reference timestamp base to the target reference timestamp base, and updating the local session establishment time to the target session establishment time.
12. The method according to claim 9, wherein, further includes: If the server fails to find the second target session based on the second session communication request, establish a third target session corresponding to the server, where the third target session is a new session established by the server according to the second session communication request; Receiving the session establishment time and the third reference timestamp base of the third target session sent by the server; Storing the session establishment time of the third target session and the third reference timestamp base.
13. A processing device for communication sessions, wherein, the device includes: A session communication request acquisition module, configured to acquire a session communication request sent by a client; the session communication request is generated by the client in response to a session request operation for establishing a session for the first time, or in response to a session request operation for establishing a session for non - first time, and is generated by using the request time and the request timestamp base corresponding to the session request operation; The first target session establishment module is used to establish a first target session corresponding to the session communication request and generate a first reference timestamp base for the first target session if no timestamp base is included in the session communication request. The target timestamp base generation module is used to obtain the request time corresponding to the session communication request and the response time for responding to the session communication request if a requested timestamp base is included in the session communication request, and perform timestamp verification on the requested timestamp base according to the request time and the response time to obtain a target timestamp base corresponding to the session communication request. The second target session determination module is used to use the session to which the second reference timestamp base corresponding to the target timestamp base belongs as the second target session corresponding to the session communication request. The data communication module is used to perform data communication with the client based on the first target session or the second target session.
14. A processing device for a communication session Characterized in that The device includes: The first session communication request generation module is used to respond to a session request operation. If the session request operation is an operation for establishing a session for the first time, generate a first session communication request corresponding to the session request operation and send the first session communication request to the server, so that the server establishes a first target session based on the first session communication request and generates a first reference timestamp base for the first target session; wherein, no timestamp base is included in the first session communication request. The second session communication request generation module is used to obtain the request time and the requested timestamp base corresponding to the session request operation if the session request operation is not an operation for establishing a session for the first time, and generate a second session communication request corresponding to the session request operation by using the request time and the requested timestamp base. The second session communication request sending module is used to send the second session communication request to the server, so that the server establishes a second target session based on the second session communication request; the second target session is the session to which the second reference timestamp base corresponding to the target timestamp base belongs; the target timestamp base is obtained by performing timestamp verification on the requested timestamp base according to the request time corresponding to the second session communication request and the response time for responding to the second session communication request. The data communication module is used to perform data communication with the server based on the first target session or the second target session.
15. An electronic device Characterized in that It includes a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete mutual communication through the communication bus. The memory is used to store a computer program. When the processor is used to execute the program stored on the memory, it implements the method according to any one of claims 1-12.
16. A computer-readable storage medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1-12.
Citation Information
Patent Citations
Session keeping method, device, equipment, medium and program product
CN114338689A
Session processing method and device and computer readable storage medium
CN114363395A