Support & information center

Integrating the watchRTC SDK with server-side rendering frameworks like Next.js

When using server side rendering frameworks such as Next.js, the watchRTC SDK gets integrated and built on a server platform instead of inside the browser itself. This may lead to execution errors once you import and include the watchRTC SDK.

You may bump into something like this error message:

To avoid this error message, you just need load our watchRTC SDK dynamically:

useEffect(() => {
    async function initWRTC() {
      const watchrtc = await import("@testrtc/watchrtc-sdk");
      watchrtc.init({...});
    }
    initWRTC();
  });Code language: TypeScript (typescript)

Was this article helpful?

Related Articles