messages/ept/service.go
func (s *Service) EndpointMessage(channelID string) (*Message, error) {
	c := make(chan *result)
	done := make(chan bool)

	req := &req{channelID: channelID, callback: c, done: done}

	go s.processing(req)

	select {
	case result := <-c:
		return result.msg, result.err
	case <-time.After(s.timeout):
		close(done)
		return nil, ErrTimeOut
	}
}
func (s *Service) EndpointMessage(channelID string) (*Message, error) {
	c := make(chan *result)
	done := make(chan bool)

	req := &req{channelID: channelID, callback: c, done: done}

	go s.processing(req)

	select {
	case result := <-c:
		return result.msg, result.err
	case <-time.After(s.timeout):
		close(done)
		return nil, ErrTimeOut
	}
}
// EndpointMessage returns the endpoint message object.