func (c *_Conn) unsubscribe(unsubMsg utp.Unsubscribe, topic *security.Topic) (err error) {
	c.Lock()
	defer c.Unlock()

	key := string(topic.Key)
	// Remove the subscription from stats and if there's no more subscriptions, notify everyone.
	if last, messageID := c.subs.Decrement(topic.Topic[:topic.Size], key); last {
		// Unsubscribe the subscriber
		if err = store.Subscription.Delete(c.clientID.Contract(), messageID, topic.Topic[:topic.Size]); err != nil {
			log.ErrLogger.Err(err).Str("context", "conn.unsubscribe").Str("topic", string(topic.Topic[:topic.Size])).Int64("connid", int64(c.connID)).Msg("unable to unsubscribe to topic") // Unable to subscribe
			return err
		}
		// Decrement the subscription counter
		c.service.meter.Subscriptions.Dec(1)
	}
	if !unsubMsg.IsForwarded && Globals.Cluster.isRemoteContract(fmt.Sprint(c.clientID.Contract())) {
		// The topic is handled by a remote node. Forward message to it.
		if err := Globals.Cluster.routeToContract(&unsubMsg, topic, message.UNSUBSCRIBE, &message.Message{}, c); err != nil {
			log.ErrLogger.Err(err).Str("context", "conn.unsubscribe").Int64("connid", int64(c.connID)).Msg("unable to unsubscribe to remote topic")
			return err
		}
	}
	return nil
}
// unsubscribe unsubscribes this client from a particular topic.
unsubscribe unsubscribes this client from a particular topic.
// unsubscribe unsubscribes this client from a particular topic .
func (c *_Conn) unsubscribe(unsubMsg utp.Unsubscribe, topic *security.Topic) (err error) {
	c.Lock()
	defer c.Unlock()
	key := string(topic.Key)
	if last, messageID := c.subs.Decrement(topic.Topic[:topic.Size], key); last {
		if err = store.Subscription.Delete(c.clientID.Contract(), messageID, topic.Topic[:topic.Size]); err != nil {
			log.ErrLogger.Err(err).Str("context", "conn.unsubscribe").Str("topic", string(topic.Topic[:topic.Size])).Int64("connid", int64(c.connID)).Msg("unable to unsubscribe to topic") 
			return err
		}
		c.service.meter.Subscriptions.Dec(1)
	}
	if !unsubMsg.IsForwarded && Globals.Cluster.isRemoteContract(fmt.Sprint(c.clientID.Contract())) {
		if err := Globals.Cluster.routeToContract(&unsubMsg, topic, message.UNSUBSCRIBE, &message.Message{}, c); err != nil {
			log.ErrLogger.Err(err).Str("context", "conn.unsubscribe").Int64("connid", int64(c.connID)).Msg("unable to unsubscribe to remote topic")
			return err
		}
	}
	return nil
}
func ( c * _Conn ) unsubscribe ( unsubMsg utp . Unsubscribe , topic * security . Topic ) ( err error ) { c . Lock ( ) defer c . Unlock ( ) key := string ( topic . Key ) if last , messageID := c . subs . Decrement ( topic . Topic [ : topic . Size ] , key ) ; last { if err = store . Subscription . Delete ( c . clientID . Contract ( ) , messageID , topic . Topic [ : topic . Size ] ) ; err != nil { log . ErrLogger . Err ( err ) . Str ( " " , " " ) . Str ( " " , string ( topic . Topic [ : topic . Size ] ) ) . Int64 ( " " , int64 ( c . connID ) ) . Msg ( " " ) return err } c . service . meter . Subscriptions . Dec ( 1 ) } if ! unsubMsg . IsForwarded && Globals . Cluster . isRemoteContract ( fmt . Sprint ( c . clientID . Contract ( ) ) ) { if err := Globals . Cluster . routeToContract ( & unsubMsg , topic , message . UNSUBSCRIBE , & message . Message { } , c ) ; err != nil { log . ErrLogger . Err ( err ) . Str ( " " , " " ) . Int64 ( " " , int64 ( c . connID ) ) . Msg ( " " ) return err } } return nil }
unsubscribe unsubscribes this client from a particular topic.
unsubscribe unsubscribes this client from a particular topic .
// Remove the subscription from stats and if there's no more subscriptions, notify everyone. // Unsubscribe the subscriber // Unable to subscribe // Decrement the subscription counter // The topic is handled by a remote node. Forward message to it.