Building a Message Queue
Joining a call and sending messages works great. But there’s a problem that you might have already discovered: the way you’ve written the chat feature, it’s possible for users to compose and attempt to send messages outside of a connected state. Go ahead and reload one of your browser windows and, before joining the call, compose and send a message. You’ll see the message appended in the chat box as though everything’s hunky-dory, but the input box will not be cleared and your console will report an error like Uncaught TypeError: can’t access property "send", $peer.chatChannel is undefined.
We need to decide what to do when users compose and send messages outside of a connected call state. While we could do something ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access