I'm writing messages server in go and can't recognize best way to send
response messages to clients.
Server is goroutine, which listens single channel of messages. Messages are
received by multiple connection pool (some of them receive protobuf encoded
messages over tcp socket, some - json encoded messages over web socket;
clients over different connections are equivalent). After processing
message i have to write an asnwer. I know 2 variants:
1) i can store multiple chanels for different connection pool and store a
map, which holds match clientId => chan. in this case i have to listen for
one more channel to receive new output channels and have to store the map
with matches.
2) i can pass chan for response in message. but in some situations i have
to send information not only for sender of message, but also to another
connections. so
Maybe there is a "ussual" way for this problem?
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.