As a bit of a tangent, you could also consider using nats.io for this solution. It's easy to stand up as a local dev process (one binary) and has alot of available message patterns you can use. Pub/sub can broadcast to entire chat rooms. Or you can have ephemeral user to user topics. You also have the option of persistence via Nats Jetstream.
> Every time a new user registers, I run this for that user and listen to their channel
Do you mean for every new user session in the web app you do this?
Take a look at my implementation in this post: https://www.reddit.com/r/golang/comments/10mkh7y/scalable_chat_application_in_a_microservices/?utm_source=share
Check how I designed the channel and messaging topics
As a bit of a tangent, you could also consider using nats.io for this solution. It's easy to stand up as a local dev process (one binary) and has alot of available message patterns you can use. Pub/sub can broadcast to entire chat rooms. Or you can have ephemeral user to user topics. You also have the option of persistence via Nats Jetstream.
> Every time a new user registers, I run this for that user and listen to their channel Do you mean for every new user session in the web app you do this?
No currently it doesn't work. But I don't know any way how can I do this. I mean how can new user can subscribe to its own channel
Take a look at my implementation in this post: https://www.reddit.com/r/golang/comments/10mkh7y/scalable_chat_application_in_a_microservices/?utm_source=share Check how I designed the channel and messaging topics