func run()

in TestChatServer/go/chatroom.go [23:39]


func run(reg chan *websocket.Conn, unreg chan *websocket.Conn, msg chan Msg) {
	conns := make(map[*websocket.Conn]int)
	for {
		select {
		case c := <-reg:
			conns[c] = 1
		case c := <-unreg:
			delete(conns, c)
		case msg := <-msg:
			for c := range conns {
				if c != msg.sender {
					websocket.Message.Send(c, msg.msg)
				}
			}
		}
	}
}