tencent cloud

Feedback

H5 Real-Time Communication

Last updated: 2024-11-28 10:47:23
    In order to help customers quickly migrate existing H5 pages to TCMPP, the mini program supports embedding h5 pages within mini programs using the web-view component. Additionally, TCMPP enables H5 pages to call mini-program APIs using JSSDK and support real-time communication between H5 pages and mini-programs. This is not only a technical innovation, but also a key factor in optimizing the user experience.
    
    Data sharing: By establishing an effective communication mechanism, the user's actions and status in the mini program can be transmitted to the H5 page in real time and vice versa. This instant sharing of data ensures user consistency across pages, making it easier for users to complete tasks.
    Capability expansion: The integration of mini-program with H5 pages extends the overall capabilities. For example, a mini-program can call specific functions within an H5 page or process data from an H5 page.
    Improve development efficiency: Developers can leverage existing H5 page resources without redeveloping the same features. The communication mechanism enables better integration between mini programs and H5 pages, reducing migration, development, and maintenance costs.
    Adapt to diverse needs:Different users may have varying habits and requirements. The communication mechanism allows developers to flexibly adjust interactions between mini programs and H5 pages based on user feedback and needs.
    
    In summary, enabling communication between mini programs and embedded H5 pages via the web-viewcomponent not only enhances the user experience but also provides developers with greater flexibility and convenience.
    

    sendWebviewEvent

    Feature description:The mini program sends message events to the H5 page embedded within the web-viewcomponent.
    Example:For more information about the real-time communication, seeCommunication section in JSSDK - API description.

    The mini program sends message events to H5 page

    JAVASCRIPT
    H5 JAVASCRIPT
    wx.sendWebviewEvent({
    message: "I'm Miniprogram, I received"
    })
    function onEvent(e) {
    console.log(e.message) // I'm Miniprogram, I received
    }
    // Register a listener
    wx.miniProgram.onWebviewEvent(onEvent)
    // Remove the listener
    wx.miniProgram.offWebviewEvent(onEvent)
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support