An attempt to write idiomatic go code and better encapsulate subscription and client handling into a dedicated package.
The Idea is to spawn multiple chat channels just by configuring channel name and websocket path in the routes.go file. The idea is to loop through a websocket config collection and using closure to initialize distinct instances for each configured channel, listening to redis messages on the subscribed channels.
This demo helped me a lot to set up chat server on heroku,
I had to extend to support multiple channels to make it work for my use case.
Hope my contribution helps some one who faced the same problem as me.
An attempt to write idiomatic go code and better encapsulate subscription and client handling into a dedicated package.
The Idea is to spawn multiple chat channels just by configuring channel name and websocket path in the routes.go file. The idea is to loop through a websocket config collection and using closure to initialize distinct instances for each configured channel, listening to redis messages on the subscribed channels.
This demo helped me a lot to set up chat server on heroku, I had to extend to support multiple channels to make it work for my use case.
Hope my contribution helps some one who faced the same problem as me.
you can check this medium article for more info : https://medium.com/@rahulroymattam/a-scalable-multi-channel-golang-messaging-server-on-heroku-edf7b236b7ff