are ordered they come back // in the right order. for _, responseChan := range responses { for { // ordered, processed results onto response. response := <-responseChan if *response.Type == endStreamResponse { break } } }
// sends request over the wire and returns } ! // single goroutine handles responses from server func (s *Server) handleResponses() { for { r := <-s.responses // returns the chan that was sent with // call to Request c := s.getResponseChannel(r) c <- r } }