目录

What are the differences between JSBridge communication and port communication in WebView?

Question

  1. Messages can be sent and received through a WebMessagePort object.
  2. Messages can also be sent and received through runJavaScript and registerJavaScriptProxy of JSBridge.

What are the differences between them? What are the specifications for data transfer? What are the scenarios for selecting a solution?

Answer

JSBridge is a communication mechanism between JavaScript and web clients. With JSBridge, you can call functions provided by the client in WebView or call JavaScript functions from the client. For complex communication scenarios, you can use the port communication to implement more flexible cross-platform communication.

Reference

Invoking Frontend Page Functions on the Application

Invoking Application Functions on the Frontend Page

Establishing a Data Channel Between the Application and the Frontend Page