How do we turn on and off room provider? #477
-
In our current setup, we use the live presence features of LiveBlocks and we're super happy with it 💚 We've integrated it with NextAuth, and that works flawlessly for the authentication part ✨ In order to satisfy the business requirements and avoid websocket connections for private projects(room per project), we need to tweak the code so it doesn't connect initially to live blocks servers. - <RoomProvider id={projectUUID}>{children}</RoomProvider>
+ <RoomProvider id={projectUUID} withoutConnecting>{children}</RoomProvider> The room provider seems to create the websocket connection on the component mount. If we remove the How do you advise that we proceed with this need? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@nvie I've added a sample implementation that might be sufficient to provide the connection control to the devs. The base idea is to pass on the Please check it out at #484 |
Beta Was this translation helpful? Give feedback.
-
Hello @kachar, Thanks for the question and kind words! Here's what I understand from your use case, let me know if any of it is wrong.
Have you thought about using a substitution UI when you do not want to have it connected? isConnected ?
(
<RoomProvider>
<MyComponent />
</RoomProvider>
) :
<MyComponent /> Where Let me know if this helps 🙏 Cheers, Florent |
Beta Was this translation helpful? Give feedback.
Hello @kachar,
Thanks for the question and kind words!
Here's what I understand from your use case, let me know if any of it is wrong.
@liveblocks/react
and@liveblocks/client
Have you thought about using a substitution UI when you do not want to have it connected?
Where
<MyComponent />
can work in both instances?Or perhaps a
<MyDisplayComponent />
whenisConnected === false
…