Disconnect a client

@param  Client $client  The client to disconnect
@param  string $message Data to write to the socket.
@return mixed
514465
public function disconnect(Client $client, $message = 'Goodbye.')
    {
        $this->fire(self::CLIENT_DISCONNECT, $client, $message);

        $this->log('Client disconnected: <pop>'.$client.'</pop>', Logger::INFO);

        $client->disconnect();

        $i = array_search($client, $this->clients);
        unset($this->clients[$i]);
    }
460227
function disconnect() {
  var force = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
  var cb = arguments.length <= 1 || arguments[1] === undefined ? undefined : arguments[1];

  console.log('Disconnecting client: ' + clientId);
  stopPub = true;
  client.end(force, cb);
}
737988
public static function destoryClient($client_id)
    {
        if ($client_id === Context::$client_id) {
            return static::destoryCurrentClient();
        } // 不是发给当前用户则使用存储中的地址
        else {
            $address_data = Context::clientIdToAddress($client_id);
            if (!$address_data) {
                return false;
            }
            $address = long2ip($address_data['local_ip']) . ":{$address_data['local_port']}";
            return static::destroyAddress($address, $address_data['connection_id']);
        }
    }
908985
def disconnect(self, message=""):
        
        try:
            del self.connected
        except AttributeError:
            return

        self.quit(message)

        self.transport.close()

        self._handle_event(Event("disconnect", self.server, "", [message]))
559008
public function client($client = null)
    {
        if (!func_num_args()) {
            return $this->_client;
        }
        $this->_client = $client;
        return $this;
    }
859588
def disconnect(self, reason):
        """"""
        self._server._disconnect_client(self._conn_key, self, reason)
583126
function _disconnect($msg = 'Client Quit')
    {
        if ($this->bitmap) {
            $data = pack('C', NET_SSH1_CMSG_EOF);
            $this->_send_binary_packet($data);

            $response = $this->_get_binary_packet();
            switch ($response[NET_SSH1_RESPONSE_TYPE]) {
                case NET_SSH1_SMSG_EXITSTATUS:
                    $data = pack('C', NET_SSH1_CMSG_EXIT_CONFIRMATION);
                    break;
                default:
                    $data = pack('CNa*', NET_SSH1_MSG_DISCONNECT, strlen($msg), $msg);
            }

            $this->_send_binary_packet($data);
            fclose($this->fsock);
            $this->bitmap = 0;
        }
    }
870858
public function reply(Client $client, MessageInterface $msg)
    {
        $this->getStream('client')->send($msg, $client->getId());
        $this->remove($client);
    }
591216
public function setClient(Client $client)
    {
        // Assign the client.
        $this->client = $client;
        $this->client->setDefaultOption('headers', ['Content-Type' => 'application/json']);

        // Allow chaining.
        return $this;
    }
275153
def clientdisconnect(self, event):
        

        try:
            if event.clientuuid == self.remote_controller:
                self.log("Remote controller disconnected!", lvl=critical)
                self.remote_controller = None
        except Exception as e:
            self.log("Strange thing while client disconnected", e, type(e))
379752
public function reconnect($client = null)
    {
        $this->waitConnectNum ++;
        if ($client == null) {
            $client = new \swoole_mysql();
            $client->genTime = time();
        }
        $set = $this->config['mysql'][$this->active];
        $client->connect($set, function ($client, $result) use ($set) {
            $this->waitConnectNum --;
            if (! $result) {
                getInstance()->log->error($client->connect_error . ' with Mysql ' . $set['host'] . ':' . $set['port']);
            } else {
                $client->isClose = false;
                if (! isset($client->client_id)) {
                    $client->client_id = $this->establishedConn;
                    $this->establishedConn ++;
                }
                $this->pushToPool($client);
            }
        });
        $client->on('Close', [
            $this,
            'onClose'
        ]);
    }
672956
public function disconnect($drop = false)
    {
        if ($drop || ($this->isDegenerated && empty($this->outputBuffer))) {
            //$this->logger->debug("Dropping client $this [buff: " . strlen($this->outputBuffer) . ']');

            $this->inputBuffer = '';
            $this->outputBuffer = '';
            /** @noinspection PhpUsageOfSilenceOperatorInspection fclose() generates E_WARNING if socket is invalid, in this case we don't care if it's valid or not */
            @fclose($this->socket);
            throw new NodeDisconnectException($this);

        } else {
            //$this->logger->debug("Disconnecting client $this (waiting for output buffer to be send...)");
            stream_socket_shutdown($this->socket, STREAM_SHUT_RD); //Tell kernel to discard any input data from now
            $this->isDegenerated = true;
        }
    }
1125242
@Override
  public synchronized void disconnect() {
    try {
      // If there is an error with the handler, dont bother logging out.
      if (!mailClientHandler.isHalted()) {
        if (mailClientHandler.idleRequested.get()) {
          log.warn("Disconnect called while IDLE, leaving idle and logging out.");
          done();
        }

        // Log out of the IMAP Server.
        channel.write(". logout\n");
      }

      currentFolder = null;
    } catch (Exception e) {
      // swallow any exceptions.
    } finally {
      // Shut down all channels and exit (leave threadpools as is--for reconnects).
      // The Netty channel close listener will fire a disconnect event to our client,
      // automatically. See connect() for details.
      try {
        channel.close().awaitUninterruptibly(config.getTimeout(), TimeUnit.MILLISECONDS);
      } catch (Exception e) {
        // swallow any exceptions.
      } finally {
        mailClientHandler.idleAcknowledged.set(false);
        mailClientHandler.disconnected();
        if (disconnectListener != null)
          disconnectListener.disconnected();
      }
    }
  }
1218675
@Override
	public final Promise disconnect() {
		if (client != null) {
			client.close();
			client = null;
		}
		return super.disconnect();
	}
1161038
public function fire($event, &$client, $data = null)
    {
        $retval = true;

        if (!array_key_exists($event, $this->events)) {
            return;
        }

        foreach ($this->events[$event] as $callback) {
            if (!is_callable($callback)) {
                continue;
            }

            if (($retval = call_user_func($callback, $this, $client, $data)) === false) {
                break;
            }
        }

        return $retval !== false;
    }
1308856
public static function closeClient($client_id, $message = null)
    {
        if ($client_id === Context::$client_id) {
            return static::closeCurrentClient($message);
        } // 不是发给当前用户则使用存储中的地址
        else {
            $address_data = Context::clientIdToAddress($client_id);
            if (!$address_data) {
                return false;
            }
            $address      = long2ip($address_data['local_ip']) . ":{$address_data['local_port']}";
            return static::kickAddress($address, $address_data['connection_id'], $message);
        }
    }
205445
private function sendDisconnect()
    {
        if(!$this->socket || feof($this->socket))
            return;

        $payload = chr(0xe0).chr(0x00);
        fwrite($this->socket, $payload, 2);

        $this->debugMessage("DISCONNECT sent");
    }