Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,18 @@ export class Client extends AsyncEventEmitter<Events> {
this.connect();
}

/**
* Log out of current session
*
* This function prepares the client for disposal by removing all event listeners and killing the events socket.
*/
async logout(): Promise<void> {
await this.api.post("/auth/session/logout");
this.events.removeAllListeners();
this.removeAllListeners();
this.events.disconnect();
}

/**
* Prepare a markdown-based message to be displayed to the user as plain text.
* @param source Source markdown text
Expand Down
Loading