func (c *_Conn) SendMessage(msg *message.Message) bool {
	pubMsg := &utp.PublishMessage{
		Topic:   msg.Topic,   // The topic for this message.
		Payload: msg.Payload, // The payload for this message.
	}
	if msg.MessageID == 0 {
		msg.MessageID = uint16(c.MessageIds.NextID(utp.PUBLISH))
	}
	pub := &utp.Publish{
		MessageID:    msg.MessageID,    // The ID of the message
		DeliveryMode: msg.DeliveryMode, // The delivery mode of the message
		Messages:     []*utp.PublishMessage{pubMsg},
	}

	// Check batch, relay or delay delivery.
	if msg.DeliveryMode == 2 || msg.Delay > 0 {
		c.batchManager.add(msg.Delay, pubMsg)
		return true
	}

	// persist outbound
	store.Log.PersistOutbound(uint32(c.connID), pub)

	// Acknowledge the publication
	select {
	case c.pub <- pub:
	case <-time.After(publishWaitTimeout):
		return false
	}

	return true
}
// Send forwards the message to the underlying client.
Send forwards the message to the underlying client.
// Send forwards the message to the underlying client .
func (c *_Conn) SendMessage(msg *message.Message) bool {
	pubMsg := &utp.PublishMessage{
		Topic:   msg.Topic,   
		Payload: msg.Payload, 
	}
	if msg.MessageID == 0 {
		msg.MessageID = uint16(c.MessageIds.NextID(utp.PUBLISH))
	}
	pub := &utp.Publish{
		MessageID:    msg.MessageID,    
		DeliveryMode: msg.DeliveryMode, 
		Messages:     []*utp.PublishMessage{pubMsg},
	}
	if msg.DeliveryMode == 2 || msg.Delay > 0 {
		c.batchManager.add(msg.Delay, pubMsg)
		return true
	}
	store.Log.PersistOutbound(uint32(c.connID), pub)
	select {
	case c.pub <- pub:
	case <-time.After(publishWaitTimeout):
		return false
	}
	return true
}
func ( c * _Conn ) SendMessage ( msg * message . Message ) bool { pubMsg := & utp . PublishMessage { Topic : msg . Topic , Payload : msg . Payload , } if msg . MessageID == 0 { msg . MessageID = uint16 ( c . MessageIds . NextID ( utp . PUBLISH ) ) } pub := & utp . Publish { MessageID : msg . MessageID , DeliveryMode : msg . DeliveryMode , Messages : [ ] * utp . PublishMessage { pubMsg } , } if msg . DeliveryMode == 2 || msg . Delay > 0 { c . batchManager . add ( msg . Delay , pubMsg ) return true } store . Log . PersistOutbound ( uint32 ( c . connID ) , pub ) select { case c . pub <- pub : case <- time . After ( publishWaitTimeout ) : return false } return true }
Send forwards the message to the underlying client.
Send forwards the message to the underlying client .
// The topic for this message. // The payload for this message. // The ID of the message // The delivery mode of the message // Check batch, relay or delay delivery. // persist outbound // Acknowledge the publication