A communication method, system and device
By establishing a target API in the browser and determining the target function identifier based on the mapping function identifier, the problem of communication interruption after the browser version is solved, and data communication between the browser and the instant communication server is realized.
Patent Information
- Application Number
- CN202111348553.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2041-11-15
AI Technical Summary
In the prior art, after the browser version is upgraded, the function identification of the functional module changes, resulting in data communication between the instant communication server and the browser, resulting in interruption of communication services.
By establishing a target API in the target browser, the target function identification is determined based on the correspondence between the original function identification and the mapping function identification of the function module recorded in the target API, and the target function module is called according to the target function identification to realize data communication between the browser and the instant communication server.
Even after the browser is upgraded, it can be determined that the function identifier used to call the target function module in the upgraded browser can avoid interruption of communication services and realize data communication between the browser and the instant communication server.
Smart Images

Figure CN114021062B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technologies, and in particular, to a communication method, system, and device. Background Art
[0002] The WebRTC (Web Real-Time Communication) protocol is one of the most mainstream protocols in the field of Internet voice or video, with the best cross-browser support ability and the strongest real-time performance. Based on the JS (JavaScript, an instant-compiled programming language) library corresponding to the WebRTC protocol, communication between various browsers can be achieved. The JS library records the APIs corresponding to different types and versions of browsers.
[0003] Specifically, for each browser, the instant messaging server can communicate with the browser based on the API corresponding to the browser recorded in the JS library, and forward the data sent by the browser to other browsers to achieve communication between browsers.
[0004] In the prior art, the instant messaging server can send a call request (the first call request) for a target function module to a browser (the first browser). The first call request includes the function identifier (the first function identifier) of the target function module in the first browser. The corresponding relationship between the first function identifier recorded in the first API corresponding to the first browser and the target function module is such that the first browser can call the target function module according to the first function identifier and the first API. If the first browser is upgraded to the second browser, and the function identifier of the target function module in the second browser is changed to the second function identifier, then in the corresponding second API of the second browser, the recorded is the corresponding relationship between the second function identifier and the target function module. When the instant messaging server sends a call request (the second call request) for the target function module to the second browser, since the second call request still records the first function identifier, the second browser cannot call the target function module according to the first function identifier and the second API. This results in the inability to perform data communication between the second browser and the instant messaging server, causing the communication service to be interrupted. Summary of the Invention
[0005] The purpose of the embodiments of the present invention is to provide a communication method, system, and device to achieve data communication between a target browser and an instant messaging server and avoid interruption of the communication service.
[0006] The specific technical solutions are as follows:
[0007] In the first aspect of the present invention, a communication method is first provided. The method is applied to a target browser and includes:
[0008] Receive a call request for a target function module sent by an instant messaging server; the call request includes: in a browser that matches the version of the instant messaging server, the first original function identifier of the target function module;
[0009] Based on the correspondence relationship between the original function identifiers of each function module recorded in the target application programming interface (API) corresponding to the target browser and the mapped function identifiers of each function module in the target browser, determine the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser;
[0010] Call the target function module according to the target function identifier to obtain a first target resource;
[0011] Send the first target resource to the instant messaging server.
[0012] Optionally, before receiving the call request for the target function module sent by the instant messaging server, the method further includes:
[0013] Send a connection request to the instant messaging server, so that the instant messaging server sends a preset interface library to the target browser; the preset interface library records the APIs corresponding to multiple browsers of different types and different versions;
[0014] Receive the preset interface library;
[0015] Generate the target API corresponding to the target browser according to the preset interface library.
[0016] Optionally, the preset interface library records the common API parts corresponding to multiple browsers of different types and different versions, and the different API parts corresponding to each browser;
[0017] The generating the target API corresponding to the target browser according to the preset interface library includes:
[0018] Obtain the different API part corresponding to the type and version number of the target browser from the preset interface library as the target different API part;
[0019] Combine the common API part and the target different API part to obtain the target API corresponding to the target browser.
[0020] Optionally, the target different API part records the correspondence relationship between the original function identifiers of each function module and the mapped function identifiers of each function module in the target browser.
[0021] Optionally, if the target functional module is an audio functional module, the first target resource is an audio file; if the target functional module is a video functional module, the first target resource is a video file.
[0022] Optionally, the method further includes:
[0023] Receiving a second target resource sent by the instant messaging server, where the second target resource is a resource sent by a browser other than the target browser received by the instant messaging server.
[0024] In a second aspect of the implementation of the present invention, there is also provided a communication method, where the method is applied to an instant messaging server, and the method includes:
[0025] Sending a call request for a target functional module to the target browser; the call request includes: in a browser that matches the version of the instant messaging server, a first original functional identifier of the target functional module; so that the target browser determines, based on the correspondence between the original functional identifier of each functional module recorded in the target API corresponding to the target browser and the mapped functional identifier of each functional module in the target browser, the mapped functional identifier corresponding to the first original functional identifier as the target functional identifier of the target functional module in the target browser; calling the target functional module according to the target functional identifier to obtain a first target resource; sending the first target resource to the instant messaging server;
[0026] Receiving the first target resource.
[0027] Optionally, before the call request for the target functional module sent to the target browser, the method further includes:
[0028] Receiving a connection request sent by the target browser;
[0029] Sending a preset interface library to the target browser; the preset interface library records a common API part corresponding to multiple browsers of different types and different versions, and a differential API part corresponding to each browser; so that the target browser receives the preset interface library, and obtains, from the preset interface library, the differential API part corresponding to the type and version number of the target browser as the target differential API part; combining the common API part and the target differential API part to obtain the target API corresponding to the target browser.
[0030] Optionally, the target differential API part records the correspondence between the original functional identifier of each functional module and the mapped functional identifier of each functional module in the target browser.
[0031] Optionally, if the target function module is an audio function module, the first target resource is an audio file; if the target function module is a video function module, the first target resource is a video file.
[0032] Optionally, the method further includes:
[0033] Receiving a second target resource sent by a browser other than the target browser;
[0034] Sending the second target resource to the target browser.
[0035] In a third aspect of the implementation of the present invention, a communication system is further provided. The communication system includes a target browser and an instant messaging server, where:
[0036] The instant messaging server is configured to send a call request for a target function module to the target browser; the call request includes: a first original function identifier of the target function module in a browser that matches the version of the instant messaging server;
[0037] The target browser is configured to receive the call request; based on the correspondence between the original function identifiers of each function module recorded in the first target API corresponding to the target browser and the mapped function identifiers of each function module in the target browser, determine the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser; call the target function module according to the target function identifier to obtain a first target resource; send the first target resource to the instant messaging server;
[0038] The instant messaging server is further configured to receive the first target resource.
[0039] In a fourth aspect of the implementation of the present invention, a communication device is further provided. The device is applied to a target browser, and the device includes:
[0040] A first receiving module, configured to receive a call request for a target function module sent by an instant messaging server; the call request includes: a first original function identifier of the target function module in a browser that matches the version of the instant messaging server;
[0041] A target function identifier determination module, configured to determine, based on the correspondence between the original function identifiers of each function module recorded in the target application programming interface (API) corresponding to the target browser and the mapped function identifiers of each function module in the target browser, the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser;
[0042] A function call module, configured to call the target function module according to the target function identifier to obtain a first target resource;
[0043] A first sending module, configured to send the first target resource to the instant messaging server.
[0044] Optionally, the apparatus further includes:
[0045] A second sending module, configured to send a connection request to the instant messaging server before receiving a call request for a target function module sent by the instant messaging server, so that the instant messaging server sends a preset interface library to the target browser; the preset interface library records the APIs corresponding to multiple browsers of different types and different versions;
[0046] A second receiving module, configured to receive the preset interface library;
[0047] A target API generation module, configured to generate a target API corresponding to the target browser according to the preset interface library.
[0048] Optionally, the preset interface library records the common API parts corresponding to multiple browsers of different types and different versions, and the differential API parts corresponding to each browser;
[0049] The target API generation module includes:
[0050] A differential API part acquisition sub-module, configured to acquire, from the preset interface library, the differential API part corresponding to the type and version number of the target browser as the target differential API part;
[0051] A target API generation sub-module, configured to combine the common API part and the target differential API part to obtain a target API corresponding to the target browser.
[0052] Optionally, the target differential API part records the correspondence between the original function identifiers of each function module and the mapped function identifiers of each function module in the target browser.
[0053] Optionally, if the target function module is an audio function module, the first target resource is an audio file; if the target function module is a video function module, the first target resource is a video file.
[0054] Optionally, the device further includes:
[0055] A third receiving module, configured to receive a second target resource sent by the instant messaging server, where the second target resource is a resource sent by other browsers received by the instant messaging server except the target browser.
[0056] In a fifth aspect of the implementation of the present invention, there is also provided a communication device, where the device is applied to an instant messaging server, and the device includes:
[0057] A first sending module, configured to send a call request for a target function module to a target browser; the call request includes: a first original function identifier of the target function module in a browser that matches the version of the instant messaging server; so that the target browser determines, based on the correspondence between the original function identifier of each function module recorded in the target API corresponding to the target browser and the mapped function identifier of each function module in the target browser, the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser; call the target function module according to the target function identifier to obtain a first target resource; and send the first target resource to the instant messaging server.
[0058] A first receiving module, configured to receive the first target resource.
[0059] Optionally, the device further includes:
[0060] A second receiving module, configured to receive a connection request sent by the target browser before sending the call request for the target function module to the target browser.
[0061] A second sending module, configured to send a preset interface library to the target browser; the preset interface library records a common API part corresponding to multiple browsers of different types and different versions, and a differential API part corresponding to each browser; so that the target browser receives the preset interface library, obtains, from the preset interface library, the differential API part corresponding to the type and version number of the target browser as the target differential API part; and combines the common API part and the target differential API part to obtain the target API corresponding to the target browser.
[0062] Optionally, the target difference API part records the correspondence between the original function identifiers of each functional module and the mapped function identifiers of each functional module in the target browser.
[0063] Optionally, if the target functional module is an audio functional module, the first target resource is an audio file; if the target functional module is a video functional module, the first target resource is a video file.
[0064] Optionally, the apparatus further includes:
[0065] A third receiving module, configured to receive a second target resource sent by a browser other than the target browser;
[0066] A third sending module, configured to send the second target resource to the target browser.
[0067] An embodiment of the present invention further provides an electronic device, which includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete mutual communication through the communication bus;
[0068] The memory is used for storing a computer program;
[0069] The processor, when executing the program stored on the memory, implements the communication method described in any one of the above.
[0070] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the communication method described in any one of the above is implemented.
[0071] An embodiment of the present invention further provides a computer program product including instructions, and when it runs on a computer, it causes the computer to execute the communication method described in any one of the above.
[0072] The communication method provided by the embodiment of the present invention receives a call request for a target functional module sent by an instant messaging server; the call request includes: a first original function identifier of the target functional module in a browser that matches the version of the instant messaging server; based on the correspondence between the original function identifiers of each functional module and the mapped function identifiers of each functional module in the target browser recorded in the target API corresponding to the target browser, determine the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target functional module in the target browser; call the target functional module according to the target function identifier to obtain a first target resource; send the first target resource to the instant messaging server.
[0073] After receiving the original function identifier, the corresponding target function identifier in the target browser can be determined based on the target API. That is, even if the target browser has been upgraded, the function identifier used to call the target function module in the upgraded target browser can be determined. The target browser can then call the target function module based on the target function identifier to obtain the first target resource, thus realizing data communication between the target browser and the instant messaging server and avoiding interruption of communication services.
[0074] Of course, it is not necessary for any product or method implementing the present invention to achieve all of the above advantages simultaneously. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other embodiments based on these drawings.
[0076] Figure 1 It is a flowchart of a communication method provided by an embodiment of the present invention;
[0077] Figure 2 It is a flowchart of another communication method provided by an embodiment of the present invention;
[0078] Figure 3 It is a flowchart of another communication method provided by an embodiment of the present invention;
[0079] Figure 4 It is a schematic diagram of a preset interface library provided by an embodiment of the present invention;
[0080] Figure 5 It is a flowchart of a communication method provided by an embodiment of the present invention;
[0081] Figure 6 It is a flowchart of another communication method provided by an embodiment of the present invention;
[0082] Figure 7 It is a structural diagram of a communication system provided by an embodiment of the present invention;
[0083] Figure 8 It is a structural diagram of a communication device provided by an embodiment of the present invention;
[0084] Figure 9 It is a structural diagram of a communication device provided by an embodiment of the present invention;
[0085] Figure 10 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0086] Next, in combination with the accompanying drawings in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art based on this application belong to the scope of protection of the present invention.
[0087] In the prior art, when the browser is upgraded, the function identifiers corresponding to the function modules in the browser may change. Then, when the upgraded browser receives a call request for a function module sent by the instant messaging server, it may not be able to call the corresponding function module according to the function identifier in the call request. As a result, data communication between the browser and the instant messaging server cannot be carried out, causing the communication service to be interrupted.
[0088] To solve the above problems, an embodiment of the present invention provides a communication method, which is applied to a target browser. Refer to Figure 1 , Figure 1 which is a flowchart of a communication method provided by an embodiment of the present invention. The method may include the following steps:
[0089] S101: Receive a call request for a target function module sent by the instant messaging server.
[0090] S102: Based on the correspondence between the original function identifiers of each function module recorded in the target API corresponding to the target browser and the mapped function identifiers of each function module in the target browser, determine the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser.
[0091] S103: Call the target function module according to the target function identifier to obtain a first target resource.
[0092] S104: Send the first target resource to the instant messaging server.
[0093] The call request includes: the first original function identifier of the target function module in a browser that matches the version of the instant messaging server.
[0094] Based on the communication method provided by the embodiment of the present invention, after receiving the original function identifier, the target function identifier corresponding to it in the target browser can be determined based on the target API. That is, even if the target browser has been upgraded, the function identifier used to call the target function module in the upgraded target browser can be determined. The target browser can then call the target function module based on the target function identifier to obtain a first target resource, thus realizing data communication between the target browser and the instant messaging server and avoiding interruption of the communication service.
[0095] In one implementation, the target browser can be any type and any version of browser. Each functional module based on the WebRTC protocol is built into the target browser, such as an audio functional module and a video functional module. The target functional module can be any one of the above functional modules. To implement audio communication between browsers, the instant messaging server can send a call request for the audio function to the target browser, so that the target browser calls the audio functional module to obtain an audio file and sends it to the instant messaging server, and the instant messaging server sends the audio file to other browsers except the target browser; to implement video communication between browsers, the instant messaging server can send a call request for the video function to the target browser, so that the target browser calls the video functional module to obtain a video file and sends it to the instant messaging server, and the instant messaging server sends the video file to other browsers except the target browser.
[0096] The function identifier corresponding to the target functional module represents the interface number of the interface used to call the target functional module in the target browser.
[0097] Browsers can be classified into different types according to the browser manufacturers. For example, browser A is developed by browser manufacturer A, and browser B is developed by browser manufacturer B; between different types of browsers, the interfaces used to call the same functional module may be different. Since browser manufacturers will update the browser versions, there may be different versions of the same type of browser. For example, browser A is developed by browser manufacturer A, and browser A can have browser A versions 1.0, 1.3, 2.0, etc.; between the same type but different version browsers, the interfaces used to call the same functional module may also be different.
[0098] For a certain type of browser, the first original function identifier carried in the call request sent by the instant messaging server to the browsers of this type for the target functional module can be the interface number corresponding to the target functional module in the browsers of the specified version of this type.
[0099] For example, when deploying an instant messaging server, currently, Browser A version 3.0 is widely used. In Browser A version 3.0, the audio function module based on the WebRTC protocol corresponds to Interface 1, and the video function module corresponds to Interface 2. Then, technicians can set the original function identifier in the call request for the audio function module to Interface 1, and set the original function identifier in the call request for the video function module to Interface 2. When the instant messaging server sends a call request for the audio function module to different versions of Browser A, the original function identifier of this call request is Interface 1; when the instant messaging server sends a call request for the video function module to different versions of Browser A, the original function identifier of this call request is Interface 2.
[0100] In one implementation, the version of the target browser can be a specified version, or it can be other versions. If the version of the target browser is the specified version, then the first original function identifier is the same as its corresponding mapped function identifier. If the version of the target browser is not the specified version, then the first original function identifier may not be the same as its corresponding mapped function identifier.
[0101] Technicians can use the function identifiers corresponding to each function module in the browser as the mapped function identifiers. The API can record the correspondence between the original function identifiers and the mapped function identifiers of each function module. Then, the browser can determine the corresponding mapped function identifier based on the original function identifier of each function module, and call each function module through the corresponding mapped function identifier. Therefore, when the browser upgrades its version, technicians only need to add the correspondence between the original function identifier and the mapped function identifier in the new API corresponding to the upgraded browser. The upgraded browser can then call the function module according to the new API and the call request for the function module sent by the instant messaging server. There is no need to modify the call request for the function module sent by the instant messaging server, thus avoiding modifying and testing the program code in the instant messaging server.
[0102] For example, in the call request of the instant messaging server for the audio function module, the recorded original function identifier is Interface 1, and in the target browser, the audio function module corresponds to Interface 5. Then, the correspondence recorded in the target API between the original function identifier and the mapped function identifier is the correspondence between Interface 1 and Interface 5. When the target browser receives a request to call Interface 1, the target browser can confirm through the target API that the mapped function interface corresponding to Interface 1 is Interface 5, and then call the audio function module through Interface 5.
[0103] In one embodiment, if the target function module is the audio function module, then the first target resource is an audio file; if the target function module is the video function module, then the first target resource is a video file.
[0104] The resource type of the first target resource is determined by the type of the target function module.
[0105] To achieve audio communication between browsers, the instant messaging server can send a call request for the audio function module to the target browser. To achieve video communication between browsers, the instant messaging server can send a call request for the video function module to the target browser.
[0106] In one embodiment, referring to Figure 2 , on the basis of Figure 1 , before step S101, the method may further include:
[0107] S105: Send a connection request to the instant messaging server so that the instant messaging server sends a preset interface library to the target browser.
[0108] S106: Receive the preset interface library.
[0109] S107: Generate a target API corresponding to the target browser according to the preset interface library.
[0110] The preset interface library records the APIs corresponding to multiple browsers of different types and different versions.
[0111] In one implementation, the preset interface library can be a JS library pre-created by technicians. Technicians can modify the JS library, add the APIs of different types and different versions of browsers, expand the applicable scope of the JS library, and thus enable more different types and different versions of browsers to perform data communication through the instant messaging server.
[0112] In one embodiment, the preset interface library records the common API part corresponding to multiple browsers of different types and different versions, and the differential API part corresponding to each browser.
[0113] Referring to Figure 3 , on the basis of Figure 2 , step S107 includes:
[0114] S1071: Obtain the differential API part corresponding to the type of the target browser and the version number of the target browser from the preset interface library as the target differential API part.
[0115] S1072: Combine the common API part and the target differential API part to obtain the target API corresponding to the target browser.
[0116] What is recorded in the preset interface library is the correspondence between the differential API part and the browser type and browser version.
[0117] In one implementation, the common API part is the program code part that implements the same functions for all APIs in the preset interface library. The program code part with the same functions can be used as the parent class of all APIs. The differential API part is the program code part (differential code part) in the preset interface library where each API implements functions different from other APIs. The differential code part of this API can be used as the subclass of this API.
[0118] In one embodiment, the target differential API part records the correspondence between the original function identifiers of each function module and the mapped function identifiers of each function module in the target browser.
[0119] For example, there are APIs corresponding to 10 browsers saved in the preset interface library. Each of the 10 APIs has a differential API part. Then, 10 differential API parts can be saved in the preset interface library, and the common API part of the 10 APIs can be saved.
[0120] In the embodiment of this solution, the APIs in the preset interface library are composed of a common API part and a differential API part. Only the differential API parts of the APIs corresponding to each browser are different. Therefore, when the browser is upgraded, the technician does not need to write the entire program code of the API corresponding to the upgraded browser, but only needs to write the program code of the differential API part corresponding to the upgraded browser and save it in the preset interface library. The upgraded browser can generate the corresponding API through the preset interface library. The workload of writing the program code of the API can be reduced.
[0121] See Figure 4 , Figure 4 which is a schematic diagram of the preset interface library provided by the embodiment of the present invention.
[0122] Devices represents the above-mentioned preset interface library, Handler Interface represents the above-mentioned common API part, Chrome58 and Safari11 represent the above-mentioned differential API parts, where Chrome and Safari represent the types of browsers, and 58 and 11 represent the version numbers of the browsers.
[0123] In one embodiment, a second target resource sent by the instant messaging server is received. The second target resource is a resource sent by other browsers received by the instant messaging server except the target browser.
[0124] If the instant messaging server sends a call request for the audio function module to any other browser, the second target resource is an audio file; if the instant messaging server sends a call request for the video function module to any other browser, the second target resource is a video file.
[0125] Any other browser can perform the same steps as the above target browser to generate the second target resource, and send the second target resource to the instant messaging server, which then sends the second target resource to the target browser.
[0126] In one implementation, the target browser can communicate with any other browser (the third browser) through the instant messaging server to send and receive audio files or video files to each other. For example, user A uses the target browser to have a voice call or a video call with user B who uses the third browser.
[0127] In another implementation, the target browser can only send an audio file or a video file to the instant messaging server, and the third browser only receives the audio file or video file forwarded by the instant messaging server. For example, if user A uses the target browser to start a live broadcast, the target browser only sends an audio file or a video file to the instant messaging server. If user B watches user A's live broadcast through the third browser, the third browser only receives the audio file or video file forwarded by the instant messaging server.
[0128] In another implementation, the target browser can only receive the audio file or video file forwarded by the receiving communication server, and the third browser only sends an audio file or a video file to the instant messaging server. For example, if user B uses the third browser to start a live broadcast, the third browser only sends an audio file or a video file to the instant messaging server. If user A watches user B's live broadcast through the target browser, the target browser only receives the audio file or video file forwarded by the instant messaging server.
[0129] Based on the same inventive concept, the present invention also provides a communication method applied to an instant messaging server. Refer to Figure 5 , Figure 5 which is a flowchart of a communication method provided by an embodiment of the present invention. The method may include the following steps:
[0130] S501: Send a call request for the target function module to the target browser.
[0131] The call request includes: in a browser that matches the version of the instant messaging server, the first original function identifier of the target function module; so that the target browser determines the mapping function identifier corresponding to the first original function identifier, as the target function identifier of the target function module in the target browser, based on the correspondence between the original function identifiers of each function module recorded in the target API corresponding to the target browser and the mapping function identifiers of each function module in the target browser; calls the target function module according to the target function identifier to obtain the first target resource; and sends the first target resource to the instant messaging server.
[0132] S502: Receive the first target resource.
[0133] Based on the communication method provided by the embodiments of the present invention, after receiving the original function identifier, the target function identifier corresponding thereto in the target browser can be determined based on the target API, that is, even if the target browser has been upgraded, the function identifier used to call the target function module in the upgraded target browser can be determined, and the target browser can call the target function module based on the target function identifier to obtain the first target resource, thus realizing data communication between the target browser and the instant messaging server and avoiding interruption of communication services.
[0134] The processing method of the target browser may refer to the introduction of steps S101 - S104 above.
[0135] In one embodiment, referring to Figure 6 , on the basis of Figure 5 , before step S501, the method may further include:
[0136] S503: Receive a connection request sent by the target browser.
[0137] S504: Send a preset interface library to the target browser.
[0138] The preset interface library records the common API parts corresponding to multiple browsers of different types and different versions, as well as the different API parts corresponding to each browser; so that the target browser receives the preset interface library, obtains the different API parts corresponding to the type and version number of the target browser from the preset interface library as the target different API parts; and combines the common API parts and the target different API parts to obtain the target API corresponding to the target browser.
[0139] The processing method of the target browser may refer to the introduction of steps S1071 - S1072 above.
[0140] In one embodiment, the target different API part records the correspondence between the original function identifiers of each function module and the mapping function identifiers of each function module in the target browser.
[0141] In one embodiment, if the target function module is an audio function module, the first target resource is an audio file; if the target function module is a video function module, the first target resource is a video file.
[0142] In one embodiment, the method further includes:
[0143] Step 1: Receive a second target resource sent by a browser other than the target browser.
[0144] Step 2: Send the second target resource to the target browser.
[0145] In one implementation, the instant messaging server can receive the first target resource of the target browser and can also send the second target resource of other browsers to the target browser, that is, data communication between browsers can be achieved.
[0146] Based on the same inventive concept, the present invention also provides a communication system. Refer to Figure 7 , Figure 7 which is a structural diagram of a communication system provided by an embodiment of the present invention, including: an instant messaging server 701, and multiple browsers (including browser 7021, browser 7022, and browser 7023). The embodiment of the present invention is described only by taking the case of including 3 browsers as an example, and it is not limited thereto in reality. The target browser can be any one of the above browsers 7021, 7022, and 7023.
[0147] The instant messaging server 701 is configured to send a call request for a target function module to the target browser; the call request includes: the first original function identifier of the target function module in a browser that matches the version of the instant messaging server;
[0148] The target browser is configured to receive the call request; based on the correspondence between the original function identifier of each function module recorded in the first target API corresponding to the target browser and the mapped function identifier of each function module in the target browser, determine the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser; call the target function module according to the target function identifier to obtain a first target resource; and send the first target resource to the instant messaging server;
[0149] The instant messaging server 701 is further configured to receive the first target resource.
[0150] Based on the communication system provided by the embodiments of the present invention, after receiving the original function identifier, the target browser can determine the corresponding target function identifier in the target browser based on the target API. That is, even if the target browser has been upgraded, the function identifier used to call the target function module in the upgraded target browser can be determined. The target browser can then call the target function module based on the target function identifier to obtain the first target resource, thereby realizing data communication between the target browser and the instant messaging server and avoiding interruption of communication services.
[0151] Based on the same inventive concept, the embodiments of the present invention further provide a communication device applied to the target browser. Refer to Figure 8 , Figure 8 which is a structural diagram of a communication device provided by the embodiments of the present invention. The device includes:
[0152] A first receiving module 801, configured to receive a call request for a target function module sent by the instant messaging server; the call request includes: the first original function identifier of the target function module in a browser that matches the version of the instant messaging server.
[0153] A target function identifier determination module 802, configured to determine the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser based on the correspondence between the original function identifiers of each function module recorded in the target application programming interface (API) corresponding to the target browser and the mapped function identifiers of each function module in the target browser.
[0154] A function call module 803, configured to call the target function module according to the target function identifier to obtain the first target resource.
[0155] A first sending module 804, configured to send the first target resource to the instant messaging server.
[0156] In one embodiment, the device further includes:
[0157] A second sending module, configured to send a connection request to the instant messaging server before receiving the call request for the target function module sent by the instant messaging server, so that the instant messaging server sends a preset interface library to the target browser; the preset interface library records the APIs corresponding to multiple browsers of different types and different versions.
[0158] A second receiving module, configured to receive the preset interface library.
[0159] A target API generation module, configured to generate the target API corresponding to the target browser according to the preset interface library.
[0160] In one embodiment, the preset interface library records the common API parts corresponding to multiple browsers of different types and different versions, as well as the differential API parts corresponding to each browser.
[0161] The target API generation module includes:
[0162] The differential API part acquisition sub-module is used to acquire, from the preset interface library, the differential API part corresponding to the type of the target browser and the version number of the target browser as the target differential API part.
[0163] The target API generation sub-module is used to combine the common API part and the target differential API part to obtain the target API corresponding to the target browser.
[0164] In one embodiment, the target differential API part records the correspondence between the original function identifiers of each functional module and the mapped function identifiers of each functional module in the target browser.
[0165] In one embodiment, if the target functional module is an audio functional module, the first target resource is an audio file; if the target functional module is a video functional module, the first target resource is a video file.
[0166] In one embodiment, the device further includes:
[0167] The third receiving module is used to receive the second target resource sent by the instant messaging server, where the second target resource is a resource sent by other browsers except the target browser to the instant messaging server.
[0168] Based on the same inventive concept, an embodiment of the present invention further provides a communication device applied to an instant messaging server. Refer to Figure 9 , Figure 9 which is a structural diagram of a communication device provided by an embodiment of the present invention. The device includes:
[0169] The first sending module 901 is used to send a call request for the target functional module to the target browser. The call request includes: the first original function identifier of the target functional module in a browser that matches the version of the instant messaging server, so that the target browser determines, based on the correspondence between the original function identifiers of each functional module and the mapped function identifiers of each functional module recorded in the target API corresponding to the target browser, the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target functional module in the target browser, calls the target functional module according to the target function identifier to obtain the first target resource, and sends the first target resource to the instant messaging server.
[0170] The first receiving module 902 is used to receive the first target resource.
[0171] In one embodiment, the apparatus further includes:
[0172] A second receiving module, configured to receive a connection request sent by the target browser before sending a call request for the target function module to the target browser;
[0173] A second sending module, configured to send a preset interface library to the target browser; the preset interface library records the common API parts corresponding to multiple browsers of different types and different versions, as well as the different API parts corresponding to each browser; so that the target browser receives the preset interface library, obtains the different API parts corresponding to the type and version number of the target browser from the preset interface library as the target different API parts; and combines the common API parts and the target different API parts to obtain the target API corresponding to the target browser.
[0174] In one embodiment, the target different API parts record the correspondence between the original function identifiers of each function module and the mapped function identifiers of each function module in the target browser.
[0175] In one embodiment, if the target function module is an audio function module, the first target resource is an audio file; if the target function module is a video function module, the first target resource is a video file.
[0176] In one embodiment, the apparatus further includes:
[0177] A third receiving module, configured to receive a second target resource sent by other browsers except the target browser;
[0178] A third sending module, configured to send the second target resource to the target browser.
[0179] An embodiment of the present invention further provides an electronic device, as Figure 10 shown, including a processor 1001, a communication interface 1002, a memory 1003, and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004,
[0180] The memory 1003 is used for storing a computer program;
[0181] The processor 1001 is configured to implement the communication method described in any one of the above embodiments when executing the program stored on the memory 1003.
[0182] The communication bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For the sake of convenience of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0183] The communication interface is used for communication between the above electronic device and other devices.
[0184] The memory may include a Random Access Memory (RAM), or may also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0185] The above-mentioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0186] In another embodiment provided by the present invention, a computer-readable storage medium is also provided. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above communication methods are implemented.
[0187] In another embodiment provided by the present invention, a computer program product containing instructions is also provided. When it runs on a computer, it causes the computer to execute any of the communication methods in the above embodiments.
[0188] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
[0189] It should be noted that in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including", or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device that includes a series of elements includes not only those elements but also other elements not explicitly listed, or also includes elements inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article, or device that includes the element.
[0190] Each embodiment in this specification is described in a related manner. For the same and similar parts between the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the system, device, electronic device, computer-readable storage medium, and computer program product, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0191] The above are only the preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention are all included in the protection scope of the present invention.
Claims
1. A communication method, characterized in that, Applied to a target browser, the method includes: Receiving a call request for a target function module sent by an instant messaging server; the call request includes: in a browser that matches the version of the instant messaging server, a first original function identifier of the target function module; Based on the correspondence relationship recorded in the target application programming interface (API) corresponding to the target browser between the original function identifiers of each function module and the mapped function identifiers of each function module in the target browser, determining the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser; Invoking the target function module according to the target function identifier to obtain a first target resource; Sending the first target resource to the instant messaging server; Before receiving the call request for the target function module sent by the instant messaging server, the method further includes: Sending a connection request to the instant messaging server to enable the instant messaging server to send a preset interface library to the target browser; the preset interface library records the common API parts corresponding to multiple browsers of different types and different versions, as well as the differential API parts corresponding to each browser; Receiving the preset interface library; Obtaining, from the preset interface library, the differential API part corresponding to the type and version number of the target browser as the target differential API part; Combining the common API part and the target differential API part to obtain the target API corresponding to the target browser.
2. The method according to claim 1, wherein The target differential API part records the correspondence relationship between the original function identifiers of each function module and the mapped function identifiers of each function module in the target browser.
3. The method according to claim 1, characterized in that, If the target function module is an audio function module, the first target resource is an audio file; if the target function module is a video function module, the first target resource is a video file.
4. The method according to claim 1, characterized in that, The method further includes: Receiving a second target resource sent by the instant messaging server, where the second target resource is a resource sent by a browser other than the target browser received by the instant messaging server.
5. A communication method, characterized in that, Applied to an instant messaging server, the method includes: Sending a call request for a target function module to a target browser; the call request includes: in a browser that matches the version of the instant messaging server, a first original function identifier of the target function module; so that the target browser receives the call request; based on the correspondence relationship recorded in the target API corresponding to the target browser between the original function identifiers of each function module and the mapped function identifiers of each function module in the target browser, determining the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser; invoking the target function module according to the target function identifier to obtain a first target resource; sending the first target resource to the instant messaging server; Receiving the first target resource; Before the call request for the target function module sent to the target browser, the method further includes: Receiving a connection request sent by the target browser; Sending a preset interface library to the target browser; the preset interface library records the common API parts corresponding to multiple browsers of different types and different versions, and the different API parts corresponding to each browser; so that the target browser receives the preset interface library, and obtains, from the preset interface library, the different API parts corresponding to the type and version number of the target browser as the target different API parts; combining the common API parts and the target different API parts to obtain the target API corresponding to the target browser.
6. The method according to claim 5, characterized in that, The target different API parts record the correspondence between the original function identifiers of each function module and the mapped function identifiers of each function module in the target browser.
7. The method according to claim 5, characterized in that, If the target function module is an audio function module, the first target resource is an audio file; if the target function module is a video function module, the first target resource is a video file.
8. The method according to claim 5, wherein The method further includes: Receiving a second target resource sent by a browser other than the target browser; Sending the second target resource to the target browser.
9. A communication system, characterized in that, The communication system includes a target browser and an instant messaging server, where: The instant messaging server is configured to send a call request for a target function module to the target browser; the call request includes: the first original function identifier of the target function module in a browser that matches the version of the instant messaging server; The target browser is configured to receive the call request; based on the correspondence between the original function identifiers of each function module recorded in the first target API corresponding to the target browser and the mapped function identifiers of each function module in the target browser, determine the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser; call the target function module according to the target function identifier to obtain a first target resource; send the first target resource to the instant messaging server; The instant messaging server is further configured to receive the first target resource; The target browser is further configured to, before receiving the call request, send a connection request to the instant messaging server, so that the instant messaging server sends a preset interface library to the target browser; the preset interface library records the common API parts corresponding to multiple browsers of different types and different versions, and the different API parts corresponding to each browser; receive the preset interface library; obtain, from the preset interface library, the different API parts corresponding to the type and version number of the target browser as the target different API parts; combine the common API parts and the target different API parts to obtain the target API corresponding to the target browser.
10. A communication device, characterized in that, Applied to a target browser, the device includes: A first receiving module, configured to receive a call request for a target function module sent by an instant messaging server; the call request includes: a first original function identifier of the target function module in a browser that matches the version of the instant messaging server. A target function identifier determination module, configured to determine, based on the correspondence relationship between the original function identifiers of each function module recorded in the target application programming interface (API) corresponding to the target browser and the mapped function identifiers of each function module in the target browser, the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser. A function call module, configured to call the target function module according to the target function identifier to obtain a first target resource. A first sending module, configured to send the first target resource to the instant messaging server. The device further includes: A second sending module, configured to send a connection request to the instant messaging server before receiving the call request for the target function module sent by the instant messaging server, so that the instant messaging server sends a preset interface library to the target browser; the preset interface library records the common API parts corresponding to multiple browsers of different types and different versions, and the different API parts corresponding to each browser. A second receiving module, configured to receive the preset interface library. A target API generation module, including: A different API part acquisition sub-module, configured to acquire, from the preset interface library, the different API part corresponding to the type and version number of the target browser as the target different API part. A target API generation sub-module, configured to combine the common API part and the target different API part to obtain the target API corresponding to the target browser.
11. The device according to claim 10, characterized in that, The target different API part records the correspondence relationship between the original function identifiers of each function module and the mapped function identifiers of each function module in the target browser.
12. The device according to claim 10, characterized in that, If the target function module is an audio function module, the first target resource is an audio file; if the target function module is a video function module, the first target resource is a video file.
13. The device according to claim 10, characterized in that, The device further includes: A third receiving module, configured to receive a second target resource sent by the instant messaging server, where the second target resource is a resource sent by a browser other than the target browser received by the instant messaging server.
14. A communication device, characterized in that, Applied to an instant messaging server, the device includes: A first sending module, configured to send a call request for a target function module to a target browser; the call request includes: in a browser that matches the version of the instant messaging server, a first original function identifier of the target function module; so that the target browser determines, based on the correspondence between the original function identifiers of each function module recorded in the target API corresponding to the target browser and the mapped function identifiers of each function module in the target browser, the mapped function identifier corresponding to the first original function identifier as the target function identifier of the target function module in the target browser; call the target function module according to the target function identifier to obtain a first target resource; and send the first target resource to the instant messaging server. A first receiving module, configured to receive the first target resource. The device further includes: A second receiving module, configured to receive a connection request sent by the target browser before the call request for the target function module is sent to the target browser. A second sending module, configured to send a preset interface library to the target browser; the preset interface library records the common API parts corresponding to multiple browsers of different types and different versions, and the different API parts corresponding to each browser; so that the target browser receives the preset interface library, and obtains, from the preset interface library, the different API parts corresponding to the type and version number of the target browser as the target different API parts; and combines the common API parts and the target different API parts to obtain the target API corresponding to the target browser.
15. The device according to claim 14, characterized in that, The target different API parts record the correspondence between the original function identifiers of each function module and the mapped function identifiers of each function module in the target browser.
16. The device according to claim 14, characterized in that, If the target function module is an audio function module, the first target resource is an audio file; if the target function module is a video function module, the first target resource is a video file.
17. The device according to claim 16, characterized in that, The device further includes: A third receiving module, configured to receive a second target resource sent by a browser other than the target browser. A third sending module, configured to send the second target resource to the target browser.
18. 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. The processor, when executing the program stored on the memory, implements the method steps described in any one of claims 1-4, or 5-8.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, it implements the method steps described in any one of claims 1-4, or 5-8.
Citation Information
Patent Citations
Mobile browser client and webpage interacting method, device and client
CN104462478A
Data request method and device, storage medium and electronic equipment
CN112491943A