code: func (c *Client) sendMsg(msgType message.Type, route string, data []byte) (uint, error) {
  	// TODO mount msg and encode
  	m := message.Message{
  		Type:  msgType,
  		ID:    uint(atomic.AddUint32(&c.nextID, 1)),
  		Route: route,
  		Data:  data,
  		Err:   false,
  	}
  	p, err := c.buildPacket(m)
  	if msgType == message.Request {
  		c.pendingChan <- true
  		c.pendingReqMutex.Lock()
  		if _, ok := c.pendingRequests[m.ID]; !ok {
  			c.pendingRequests[m.ID] = &pendingRequest{
  				msg:    &m,
  				sentAt: time.Now(),
  			}
  		}
  		c.pendingReqMutex.Unlock()
  	}
  
  	if err != nil {
  		return m.ID, err
  	}
  	_, err = c.conn.Write(p)
  	return m.ID, err
  }
docs: // sendMsg sends the request to the server