# Events

How to

The Web-client is packaged with an event emitter and a set of standard events. You can subscribe to any of the standard events with a callback.

const webClient = new IpscapeWebClient();

webClient.on(webClient.events.agentLogin, (response) => {
    console.log('Agent logged on', response);

The response is returned in an object passed to the callback method. The response object will contain the following fields:

Name Type Description
result object The result is returned as a JSON string. If the event results in an error, null is returned.
error object If the event callback was successful, this variable is undefined. If the callback failed, this variable returns an error message.