# Agent Logout

In 

# Usage

Fired when the agent logs out of the CTI Adaptor.

# Syntax

webClient.onAgentLogout(listener: Function);

# Arguments

Name Type Description
listener function JavaScript method executed when the API method call is completed

# Sample Javascript

const callback = (response) => {
    if (response.error) console.error(response.error);
    if (response.result)
        alert(response.result);
}
webClient.onAgentLogin(callback);

# Response

This method is asynchronous. The response is returned in an object passed to a callback method. The response object contains the following fields.

Result
Example success Response

Returns this object if the API method call was invoked successfully, false otherwise.

{
  result: {
    message: string;
    timestamp: number; // unix timestamp
  }
}
Error
Example error Response

If the logout was successful, this variable is not returned. If the logout failed or was the result of an external event (i.e. expired session) , this variable returns an array of error messages.

{
  error: ErrorResponse[];
}