// Unsubscribe will delete the subscription.
439884
func (m *MemoryBackend) Unsubscribe(client *Client, topics []string, ack Ack) error {
	// delete subscriptions
	for _, t := range topics {
		client.Session().(*memorySession).subscriptions.Empty(t)
	}

	// call ack if provided
	if ack != nil {
		ack()
	}

	return nil
}
1301775
func (mr *MockConnectorMockRecorder) Unsubscribe(name interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unsubscribe", reflect.TypeOf((*MockConnector)(nil).Unsubscribe), name)
}
1217989
func (p *Proxy) Unsubscribe(tags []string) {
	lumber.Trace("Proxy unsubscribing from '%s'...", tags)

	if len(tags) == 0 {
		return
	}

	// remove tags from subscription
	p.Lock()
	p.subscriptions.Remove(tags)
	p.Unlock()
}
421873
func (h *handler) unsubscribe(ctx context.Context, id ID) (bool, error) {
	h.subLock.Lock()
	defer h.subLock.Unlock()

	s := h.serverSubs[id]
	if s == nil {
		return false, ErrSubscriptionNotFound
	}
	close(s.err)
	delete(h.serverSubs, id)
	return true, nil
}
305176
func (c *EncodedConn) QueueSubscribe(subject, queue string, cb Handler) (*Subscription, error) {
	return c.subscribe(subject, queue, cb)
}
1213741
func (cli *Client) Unsubscribe(opts *UnsubscribeOptions) error {
	// Lock for reading and updating.
	cli.muConn.Lock()

	// Unlock.
	defer cli.muConn.Unlock()

	// Check the Network Connection.
	if cli.conn == nil {
		return ErrNotYetConnected
	}

	// Check the existence of the options.
	if opts == nil || len(opts.TopicFilters) == 0 {
		return packet.ErrNoTopicFilter
	}

	// Define a Packet Identifier.
	var packetID uint16

	// Define an error.
	var err error

	// Lock for updating the Session.
	cli.muSess.Lock()

	defer cli.muSess.Unlock()

	// Generate a Packet Identifer.
	if packetID, err = cli.generatePacketID(); err != nil {
		return err
	}

	// Create an UNSUBSCRIBE Packet.
	p, err := packet.NewUNSUBSCRIBE(&packet.UNSUBSCRIBEOptions{
		PacketID:     packetID,
		TopicFilters: opts.TopicFilters,
	})
	if err != nil {
		return err
	}

	// Set the Packet to the Session.
	cli.sess.sendingPackets[packetID] = p

	// Send the Packet to the Server.
	cli.conn.send <- p

	return nil
}
1163308
func (s *SubServer) Unsubscribe(sid string) error {
	sub, ok := s.subs[sid]

	if !ok {
		return nil
	}

	if sub.Timer != nil {
		sub.Timer.Stop()
	}

	delete(s.subs, sid)

	req, err := http.NewRequest(
		"UNSUBSCRIBE",
		sub.ServiceURL,
		nil)
	req.Close = true
	req.Header.Add("SID", sub.SID)

	client := &http.Client{}
	resp, err := client.Do(req)
	if resp != nil {
		defer resp.Body.Close()
	}

	if err != nil {
		return err
	}
	if resp.StatusCode != 200 {
		return fmt.Errorf("error unsubscribing, status code: %d", resp.StatusCode)
	}
	return nil
}
860123
func (client *BaseClient) Unsubscribe(name string, id ...string) {
	client.topicManager.locker.Lock()
	if client.allTopics[name] != nil {
		if len(id) == 0 {
			if client.id == "" {
				delete(client.allTopics, name)
			} else {
				delete(client.allTopics[name], client.id)
			}
		} else {
			for i := range id {
				delete(client.allTopics[name], id[i])
			}
		}
		if len(client.allTopics[name]) == 0 {
			delete(client.allTopics, name)
		}
	}
	client.topicManager.locker.Unlock()
}
1126104
func (s *Server) Unsubscribe(ctx context.Context, clientID string, query Query) error {
	s.mtx.RLock()
	clientSubscriptions, ok := s.subscriptions[clientID]
	if ok {
		_, ok = clientSubscriptions[query.String()]
	}
	s.mtx.RUnlock()
	if !ok {
		return ErrSubscriptionNotFound
	}

	select {
	case s.cmds <- cmd{op: unsub, clientID: clientID, query: query}:
		s.mtx.Lock()
		delete(clientSubscriptions, query.String())
		if len(clientSubscriptions) == 0 {
			delete(s.subscriptions, clientID)
		}
		s.mtx.Unlock()
		return nil
	case <-ctx.Done():
		return ctx.Err()
	case <-s.Quit():
		return nil
	}
}
857028
func (c Client) Cancel(id string, params *stripe.SubscriptionCancelParams) (*stripe.Subscription, error) {
	path := stripe.FormatURLPath("/v1/subscriptions/%s", id)
	sub := &stripe.Subscription{}
	err := c.B.Call(http.MethodDelete, path, c.Key, params, sub)
	return sub, err
}
854416
func (h *apiExecutor) Unsubscribe(ctx context.Context, cmd *UnsubscribeRequest) *UnsubscribeResponse {
	defer func(started time.Time) {
		apiCommandDurationSummary.WithLabelValues(h.protocol, "unsubscribe").Observe(time.Since(started).Seconds())
	}(time.Now())

	resp := &UnsubscribeResponse{}

	user := cmd.User
	channel := cmd.Channel

	if user == "" {
		h.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, "user required for unsubscribe", map[string]interface{}{"channel": channel, "user": user}))
		resp.Error = ErrorBadRequest
		return resp
	}

	if channel != "" {
		_, ok := h.node.ChannelOpts(channel)
		if !ok {
			resp.Error = ErrorNamespaceNotFound
			return resp
		}
	}

	err := h.node.Unsubscribe(user, channel)
	if err != nil {
		h.node.Log(centrifuge.NewLogEntry(centrifuge.LogLevelError, "error unsubscribing user from channel", map[string]interface{}{"channel": channel, "user": user, "error": err.Error()}))
		resp.Error = ErrorInternal
		return resp
	}
	return resp
}
388198
func (m *Miniredis) removeSubscriber(s *Subscriber) {
	_, ok := m.subscribers[s]
	delete(m.subscribers, s)
	if ok {
		s.Close()
	}
}
1265216
func (s *Socket) Unsubscribe(filter []byte) {
	s.setBinary(C.ZMQ_UNSUBSCRIBE, filter)
}
894499
func (s *ConfirmSubscriptionInput) SetAuthenticateOnUnsubscribe(v string) *ConfirmSubscriptionInput {
	s.AuthenticateOnUnsubscribe = &v
	return s
}
411107
func (c *Client) Unsubscribe(topic string) (GenericFuture, error) {
	return c.UnsubscribeMultiple([]string{topic})
}
398615
func (w *WSEvents) UnsubscribeAll(ctx context.Context, subscriber string) error {
	if err := w.ws.UnsubscribeAll(ctx); err != nil {
		return err
	}

	w.mtx.Lock()
	w.subscriptions = make(map[string]chan ctypes.ResultEvent)
	w.mtx.Unlock()

	return nil
}
322727
func (sp *ServerPeer) unsubscribeRecvMsgs(subscription spMsgSubscription) {
	sp.mtxSubscribers.Lock()
	defer sp.mtxSubscribers.Unlock()
	delete(sp.recvSubscribers, subscription)
}