Unsubscribe from pattern channel(s).

@param conn The client connection.
@param channels Array of channels.
769468
function punsubscribe(conn, channels) {
  return this.doUnsubscribe(
    PUBSUB.PUNSUBSCRIBE,
    PUBSUB.PATTERNS,
    this._patterns, conn, channels);
}
293778
def unsubscribe(self, connection):
        """"""
        self._subscribed_connections.discard(connection)
        self._last_unsubscribe_time = current_time()
1144743
def client_end(request, socket, context):
    
    # Send the unsubscribe event prior to actually unsubscribing, so
    # that the finish event can still match channels if applicable.
    for channel in socket.channels:
        events.on_unsubscribe.send(request, socket, context, channel)
    events.on_finish.send(request, socket, context)
    # Actually unsubscribe to cleanup channel data.
    for channel in socket.channels[:]:
        socket.unsubscribe(channel)
    # Remove the client.
    del CLIENTS[socket.session.session_id]
551140
function unsubscribe (channels) {
    pullAll(_subscribedChannels, channels)
    if (_socket) channels.forEach(channel => _socket.unsubscribe(channel))
    return connection
  }
1371303
public static void close(Connection conn) {
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException ex) {
                logger.error("", ex);
            }
        }
    }
959279
public static void hideOnlyChannels(Object... channels){
    for(LogRecordHandler handler : handlers){
      if(handler instanceof VisibilityHandler){
        VisibilityHandler visHandler = (VisibilityHandler) handler;
        visHandler.showAll();
        for (Object channel : channels) {
          visHandler.alsoHide(channel);
        }
      }
    }
  }
1167031
private void removeConnectionCallbacks() {
        connection.removeSyncStanzaListener(messageListener);
        if (messageCollector != null) {
            messageCollector.cancel();
            messageCollector = null;
        }
    }
1199166
public void disconnect(IConnection conn) {
        log.debug("Disconnect: {}", conn);
        // call disconnect handlers in reverse order of connection. ie. roomDisconnect is called before appDisconnect.
        final IClient client = conn.getClient();
        if (client == null) {
            // early bail out
            removeEventListener(conn);
            connectionStats.decrement();
            if (hasParent()) {
                parent.disconnect(conn);
            }
            return;
        }
        // remove it if it exists
        if (clients.remove(client)) {
            IScopeHandler handler = getHandler();
            if (handler != null) {
                try {
                    handler.disconnect(conn, this);
                } catch (Exception e) {
                    log.error("Error while executing \"disconnect\" for connection {} on handler {}. {}", new Object[] { conn, handler, e });
                }
                try {
                    // there may be a timeout here ?
                    handler.leave(client, this);
                } catch (Exception e) {
                    log.error("Error while executing \"leave\" for client {} on handler {}. {}", new Object[] { conn, handler, e });
                }
            }
            // remove listener
            removeEventListener(conn);
            // decrement if there was a set of connections
            connectionStats.decrement();
            if (this.equals(conn.getScope())) {
                final IServer server = getServer();
                if (server instanceof Server) {
                    ((Server) server).notifyDisconnected(conn);
                }
            }
        }
        if (hasParent()) {
            parent.disconnect(conn);
        }
    }
158556
def unsubscribe_all(self, callback=False):
        """"""
        futures = ((f, r) for f, r in self._requests.items()
                   if isinstance(r, Subscribe)
                   and f not in self._pending_unsubscribes)
        if futures:
            for future, request in futures:
                if callback:
                    log.warn("Unsubscribing from %s", request.path)
                    cothread.Callback(self.unsubscribe, future)
                else:
                    self.unsubscribe(future)
365960
@Override
	public boolean unsubscribeAllChannels() {
        final Collection<BitfinexStreamSymbol> channels = getSubscribedChannels();
        final int channelsToUnsubscribe = channels.size();

        logger.debug("Calling unsubscribe for {} channels", channelsToUnsubscribe);
		final CountDownLatch countDownLatch = new CountDownLatch(channelsToUnsubscribe);

        try (Closeable c = callbackRegistry.onUnsubscribeChannelEvent(s -> countDownLatch.countDown())) {
            channels.forEach(symbol -> sendCommand(new UnsubscribeChannelCommand(symbol)));

            // Await the unsubscription
            countDownLatch.await(30, TimeUnit.SECONDS);

            return true;
        } catch (final InterruptedException | IOException e) {
            Thread.currentThread().interrupt();
            return false;
        }
	}
989936
async def _unsubscribe(self, channels, is_mask):
        """"""
        vanished = []
        if channels:
            for channel in channels:
                key = channel, is_mask
                self._channels.remove(key)
                self._plugin._subscriptions[key].remove(self._queue)
                if not self._plugin._subscriptions[key]:  # we were last sub?
                    vanished.append(channel)
                    del self._plugin._subscriptions[key]
        else:
            while self._channels:
                channel, is_mask = key = self._channels.pop()
                self._plugin._subscriptions[key].remove(self._queue)
                if not self._plugin._subscriptions[key]:
                    vanished.append(channel)
                    del self._plugin._subscriptions[key]
        if vanished:
            await getattr(self._sub, 'punsubscribe' if is_mask else 'unsubscribe')(vanished)
949770
public void unsubscribe() {
        List<InvocationHandler> handler = this.handlers.get(target);
        if (handler != null) {
            handler.remove(this.handler);
        }
    }
56744
public function onUnSubscribe(Conn $conn, $topic)
    {
        $topic->broadcast($conn->resourceId . " has left " . $topic->getId());
    }
1258364
private void disconnect(ZMQ.Socket socket, String eventName){
        String   endpoint = getConnectedEndPoint(eventName);
        if (endpoint!=null) {
            EventList eventList = connectedMap.get(endpoint);
            if (eventList!=null) {
                socket.unsubscribe(eventName.getBytes());
                traceZmqSubscription(eventName, false);
                eventList.remove(eventName);
                if (eventList.size()==0) {
                    socket.disconnect(endpoint);
                    connectedMap.remove(endpoint);
                }
            }
        }
    }
574808
protected void removeConnection(FTPConnection con) throws IOException {
        synchronized(listeners) {
            for(IFTPListener l : listeners) {
                l.onDisconnected(con);
            }
        }
        synchronized(connections) {
            connections.remove(con);
        }
    }
295138
final void close(final ConnectionPoolConnection conn) {
      if(closeQueue != null) {
         closeQueue.add(conn);
      } else {
         closer.close(conn);
      }
   }
1313319
protected void unregister(IConnection conn, boolean deleteIfNoConns) {
        log.debug("Unregister connection ({}:{}) client id: {}", conn.getRemoteAddress(), conn.getRemotePort(), id);
        // remove connection from connected scopes list
        connections.remove(conn);
        // If client is not connected to any scope any longer then remove
        if (deleteIfNoConns && connections.isEmpty()) {
            // TODO DW dangerous the way this is called from BaseConnection.initialize(). Could we unexpectedly pop a Client out of the registry?
            removeInstance();
        }
    }