Search⌘ K

Rendering and Switching Rooms

Explore how to render chat rooms and switch between them by using RxJS ReplaySubject to maintain message history and switchMap to update active room subscriptions. Understand handling user events to dynamically load messages, manage multiple streams efficiently, and present reactive chat data on a webpage.

Now, we are able to load the page, enter a username in the modal, and wait for the backend to respond with data about the current state of the chat.

After the backend responds, nothing is listening in to render anything to the page.

Rendering and switching rooms

After the user has logged in, they will want to see all of the rooms available to them and switch between them.

To accomplish this, once the login modal has closed, start listening in for any new messages that come across the web socket.

ReplaySubject

While it’s possible to not keep any history and ...