ShyyTAUI/src/lib/taDocs/3-client-disconnect.md

1.4 KiB

The taClient.disconnect() method

This documents the taClient.disconnect() method.

info
Async: This is a method you would want to use await with

This method has input parameters. The function could easily be defined as:

async function disconnect(): Promise<Response> {
    // backend logic
}

General usage:

const response: Response = taClient.disconnect();

If you have not yet, please read Client -> Introduction to the Client

Standard Response:

{
    details: {
        disconnect: Response_Disconnect,
        oneofKind: 'disconnect'
    },
    respondingToPacketId: 'packet-guid-uuidv4',
    type: Response_ResponseType
}
info
Best Practice: Always call disconnect() when your application is shutting down or when the user logs out. This ensures that all event listeners are properly cleaned up and the connection is gracefully terminated.