3 ms·
Using go's websocket library would also be viable. For the receiving end, go can use http handlers for websockets. So when a message from any websocket is rece
by andmarios 9y ago
Using go's websocket library would also be viable.
For the receiving end, go can use http handlers for websockets. So when a message from any websocket is received the handler will be spawn and process it (just as any http request). Preferably dispatch it to a big central channel.
Keeping separate channels for each websocket seems overkill to me. Go has maps. Create a map with all the websocket connections and maybe smaller maps for each chat room, then set n workers to listen to the central channel and dispatch messages directly to each room member.