PrivateFunction: _disconnect
_Private_ function called by Strophe.Connection.disconnect

Disconnects and sends a last stanza if one is given

Parameters:
(Request) pres - This stanza will be sent before disconnecting.
966266
function (pres)
    {
        if (this.socket && this.socket.readyState !== WebSocket.CLOSED) {
            if (pres) {
                this._conn.send(pres);
            }
            var close = $build("close", { "xmlns": Strophe.NS.FRAMING, });
            this._conn.xmlOutput(close);
            var closeString = Strophe.serialize(close);
            this._conn.rawOutput(closeString);
            try {
                this.socket.send(closeString);
            } catch (e) {
                Strophe.info("Couldn't send <close /> tag.");
            }
        }
        this._conn._doDisconnect();
    }
683233
def disconnect_sync(self, connection_handle):
        

        self.bable.disconnect(connection_handle=connection_handle, sync=True)
564509
def disconnect(self, message=""):
        
        try:
            del self.connected
        except AttributeError:
            return

        self.quit(message)

        try:
            self.socket.shutdown(socket.SHUT_WR)
            self.socket.close()
        except socket.error:
            pass
        del self.socket
        self._handle_event(Event("disconnect", self.server, "", [message]))
1057282
def __on_disconnect(self, client, userdata, result_code):
        # pylint: disable=W0613
        
        if result_code:
            # rc != 0: unexpected disconnection
            _logger.error(
                "Unexpected disconnection from the MQTT server: %s (%d)",
                paho.connack_string(result_code),
                result_code,
            )

            # Try to reconnect
            self.__stop_timer()
            self.__start_timer(2)

        # Notify the caller, if any
        if self.on_disconnect is not None:
            try:
                self.on_disconnect(self, result_code)
            except Exception as ex:
                _logger.exception("Error notifying MQTT listener: %s", ex)
232545
private static boolean finishLastResponse(final HttpConnection conn) {
        InputStream lastResponse = conn.getLastResponseInputStream();
        if(lastResponse != null) {
            conn.setLastResponseInputStream(null);
            try {
                lastResponse.close();
                return true;
            } catch (IOException ioe) {
                // force reconnect.
                return false;
            }
        } else {
            return false;
        }
    }
1292396
async def disconnect(self, abort=False):
        
        if self.state == 'connected':
            await self._send_packet(packet.Packet(packet.CLOSE))
            await self.queue.put(None)
            self.state = 'disconnecting'
            await self._trigger_event('disconnect', run_async=False)
            if self.current_transport == 'websocket':
                await self.ws.close()
            if not abort:
                await self.read_loop_task
            self.state = 'disconnected'
            try:
                client.connected_clients.remove(self)
            except ValueError:  # pragma: no cover
                pass
        self._reset()
768078
def disconnect(self, connection):
        
        self.log.debug("Disconnecting %s" % connection)
        if connection in self._pending:
            pending_frame = self._pending[connection]
            self.store.requeue(pending_frame.headers.get(
                'destination'), pending_frame)
            del self._pending[connection]

        for dest in list(self._queues.keys()):
            if connection in self._queues[dest]:
                self._queues[dest].remove(connection)
            if not self._queues[dest]:
                # This won't trigger RuntimeError, since we're using keys()
                del self._queues[dest]
651925
def disconnect(self):
        '''
        
        '''
        if not hasattr(self, '_sock'):
            return

        # TODO: If there are bytes left on the output, queue the close for
        # later.
        self._sock.close_cb = None
        self._sock.close()
1264601
async def disconnect(self):
        
        if not self.connected:
            return

        self.writer.close()
        self.reader = None
        self.writer = None
70829
def disconnect(self):
        
        self.ws.close()
        self.ingame = False
        self.subscriber.on_sock_closed()
1009408
function disconnectBody() {
        var key;
        self.loggingOut = true;
        offersPending = {};
        acceptancePending = {};
        self.disconnecting = true;
        closedChannel = self.webSocket;

        if( stillAliveTimer ) {
           clearTimeout(stillAliveTimer);
           stillAliveTimer = null;
        }

        if (self.webSocketConnected) {
            if (!preallocatedSocketIo) {
                self.webSocket.close();
            }
            self.webSocketConnected = false;
        }
        self.hangupAll();
        if (roomOccupantListener) {
            for (key in lastLoggedInList) {
                if (lastLoggedInList.hasOwnProperty(key)) {
                    roomOccupantListener(key, {}, false);
                }
            }
        }
        lastLoggedInList = {};
        self.emitEvent("roomOccupant", {});
        self.roomData = {};
        self.roomJoin = {};
        self.loggingOut = false;
        self.myEasyrtcid = null;
        self.disconnecting = false;
        oldConfig = {};
    }
345006
async def disconnect(self, conn_id):
        

        self._ensure_connection(conn_id, True)

        msg = dict(connection_string=self._get_property(conn_id, "connection_string"))

        try:
            await self._send_command(OPERATIONS.DISCONNECT, msg, COMMANDS.DisconnectResponse)
        finally:
            self._teardown_connection(conn_id)
1189719
function() {
        if(this._conn.connected && !this._conn.disconnecting) {
            Strophe.error("Websocket closed unexcectedly");
            this._conn._doDisconnect();
        } else {
            Strophe.info("Websocket closed");
        }
    }
321514
def disconnect(self):
        

        for name, wire in self.wires():
            self.cut(name, disconnect=True)
630131
def disconnect(self):
        """"""
        self.canvas.mpl_disconnect(self._cidmotion)
        self.canvas.mpl_disconnect(self._ciddraw)
1017507
def disconnect(remote_app):
    
    if remote_app not in current_oauthclient.disconnect_handlers:
        return abort(404)

    ret = current_oauthclient.disconnect_handlers[remote_app]()
    db.session.commit()
    return ret
102665
def on_disconnect(self):
        ""
        if self._stream is not None:
            self._stream = None
        if self._buffer is not None:
            self._buffer.close()
            self._buffer = None
        self.encoding = None