I need to build a conversations (chatting) feature on top of Laravel using Pusher.js. To do this, I would need websockets for the real time chatting.
However, I am not sure at what would be the correct approach towards solving this in a professional manner.
My current planned approach is:
I plan on having multiple Pusher channels. Each Conversation (DB Model) would have a channel_ID column which would be the Pusher channel name, only accessible by Sender / Recipient. Front-end would be a chatting app with multiple conversations shown. Once user clicks on conversation A, it would subscribe to that conversation's channel_ID (Pusher Channel). Once they click on conversation B, it would unsubscribe from channel A and subscribe to channel B.
My issues in the approach is following:
In Laravel, each Broadcast Event (mine is called message) has a function broadcastOn(). However I do not know how would I make this work for say, 10 000 conversations with all having a different channel name? I don't know if this is optimal, it does not seem too good to me.
I've already Googled for a couple of days and looked up many websocket related guides. Many of them go into detail how to create a public chat with everyone receiving the event, but none of them really go into detail how to create an user-to-user secure chatting feature.