code: func (s *StanServer) processClientPublish(m *nats.Msg) {
  	iopm := &ioPendingMsg{m: m}
  	pm := &iopm.pm
  	if pm.Unmarshal(m.Data) != nil {
  		if s.processCtrlMsg(m) {
  			return
  		}
  		// else we will report an error below...
  	}
  
  	// Make sure we have a guid and valid channel name.
  	if pm.Guid == "" || !util.IsChannelNameValid(pm.Subject, false) {
  		s.log.Errorf("Received invalid client publish message %v", pm)
  		s.sendPublishErr(m.Reply, pm.Guid, ErrInvalidPubReq)
  		return
  	}
  
  	if s.debug {
  		s.log.Tracef("[Client:%s] Received message from publisher subj=%s guid=%s", pm.ClientID, pm.Subject, pm.Guid)
  	}
  
  	// Check if the client is valid. We do this after the clustered check so
  	// that only the leader performs this check.
  	valid := false
  	if s.partitions != nil {
  		// In partitioning mode it is possible that we get there
  		// before the connect request is processed. If so, make sure we wait
  		// for conn request	to be processed first. Check clientCheckTimeout
  		// doc for details.
  		valid = s.clients.isValidWithTimeout(pm.ClientID, pm.ConnID, clientCheckTimeout)
  	} else {
  		valid = s.clients.isValid(pm.ClientID, pm.ConnID)
  	}
  	if !valid {
  		s.log.Errorf("Received invalid client publish message %v", pm)
  		s.sendPublishErr(m.Reply, pm.Guid, ErrInvalidPubReq)
  		return
  	}
  
  	s.ioChannel <- iopm
  }
docs: // processClientPublish process inbound messages from clients.