What happens when a channel connects one producer to multiple consumers

I am new to go and particularly new to goroutines and channels. I want to understand what happens when a channel is written to by a single producer but that same channel is used by multiple concurrent goroutines. The mental model I have is of publish subscribe of topics in messaging platforms. Is this correct?

I am using an unbufferred channel and I am assuming when the producer sends the message on the channel then a copy of the message should be received by all consumers. Is this correct?

I am running into deadlock situations so I am suspecting this assumption may be wrong.

1 Like

Thanks a bunch! This was very helpful.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.