I'm using Pusher for one-to-one real time messages between two people. This is my code when you are in the "room"
Echo.private('chat.'+this.roomid)
.listen('MessageSent',(e)=>{
this.allMessages.push(e.message)
this.scrollBottom(this.messagesContainer);
});
My question is how should be the logic when you are outside every chat and you want to show a number of new messages to you next to a message icon in the navigation? Should it be a different event that is not tied to a chat "room" but rather just to a user?