Communication method and system between WeChat applet webview and native components
A communication method and communication system technology, which are applied in the field of communication methods and systems between WeChat applet WebView and native components, and can solve problems such as limited trigger timing and complex WebView development.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0028] This embodiment provides a communication method between the WeChat applet WebView and native components, such as figure 1 As shown, the method includes the following steps:
[0029] S101. Build a WebSocket server.
[0030] WebSocket is a computer communication protocol that performs full-duplex communication on a single TCP connection. It makes data exchange between the client and the server easier and allows the server to actively push data to the client. WebSocket only needs to complete an HTTP (Hypertext Transfer Protocol) handshake, and a persistent connection can be directly established between the client and the server, and two-way data transmission can be performed. To build a WebSocket server, multiple WebSocket connections can be established with it, and two-way communication can be carried out independently.
[0031] S102. Create a first WebSocket connection connected to the WebSocket server through the native component of the user's WeChat applet.
[0032]...
Embodiment 2
[0047] This embodiment provides a communication system between the WeChat applet WebView and native components, such as figure 2 As shown, the system includes the WebSocket server building module 1, the native component 2 of the user's WeChat applet, and the WebView3 of the user's WeChat applet.
[0048] The server building module 1 is used to build a WebSocket server. A WebSocket server can establish WebSocket connections with multiple clients, and conduct two-way communication independently.
[0049] The WeChat applet may be used by multiple users at the same time, and it is necessary to establish an independent two-way communication mechanism for each user's native component and WebView. The native component 2 of the user's WeChat applet is used to create the first WebSocket connection connected to the WebSocket server.
[0050] After the user's first WebSocket connection is established, the native component 2 of the user's WeChat applet is also used to upload the corres...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 

