Client Services

Class finesse.clientservices.ClientServices

Allows clients to make the Cisco Finesse API requests and use Cisco Finesse events by using the JavaScript functions that are provided by this module. This service layer establishes a notification connection that is shared between all the gadgets and the desktop for its eventing needs. It uses events for client subscriptions and constructs API requests.

Methods

getNotificationConnectionState()

Retrieves the current state of the BOSH/WebSocket connection.

Example

Code Snippet
Copyfinesse.clientservices.ClientServices.getNotificationConnectionState();

Returns

{String} The current state of the BOSH/WebSocket connection from the following options:.

  • Connected—When the connection is established between client and openfire.

  • Recovered —When the connection is re-established after a failure.

  • Failing —When the notification service or the Cisco Finesse server is down.

getRestHost()

Retrieves the destination host where the REST requests are proxied through Shindig. This method can be used before making REST requests to retrieve the hostname.

Example

Code Snippet
Copyfinesse.clientservices.ClientServices.getRestHost();

Returns

{String} The hostname of Cisco Finesse.

init(config)

Initiates the ClientServices module with the specified configuration parameters. For more information, see Gadget Configuration.

Example

Code Snippet
Copyfinesse.clientservices.ClientServices.init(finesse.gadget.Config)

Throws

{Error} If the valid parameter is missing during initialization.

registerOnConnectHandler(handler)

Adds a handler to be invoked when the following conditions are met:

  • Cisco Finesse goes IN_SERVICE wherein all the operations of Cisco Finesse is performed or accepted.

  • BOSH/WebSocket connection is established and the client application communicates with the Cisco Finesse Notification Service through BOSH/WebSocket to receive notifications. The loss of this connection means that the server is UNAVAILABLE or that the client cannot reach the server.

  • Cisco Finesse user presence becomes available. The presence indicates whether Finesse has an active connection to the Cisco Finesse Notification Service (Unified CCE) or the Cisco Unified CCX Notification Service (Unified CCX). An UNAVAILABLE presence for the Cisco Finesse XMPP user means that the connection is lost.

For more information.

If these conditions are met when this function is called, the handler is invoked immediately.

Example
Code Snippet
Copy_cs = finesse.clientservices.ClientServices;
_cs.registerOnConnectHandler(_connectionConnectHandler);

_connectionConnectHandler = function () {
 // Perform the logic 
}

Parameters

Name

Type

Description

Required

handler

Function

The function that is invoked when the conditions are met. Registers only one handler at a time. Handlers registered earlier are overwritten.

Yes

registerOnDisconnectHandler(handler)

Adds a handler or callback to be invoked when any of the following occurs:

  • Cisco Finesse is no longer IN_SERVICE

  • BOSH/WebSocket connection is lost

  • Cisco Finesse user presence becomes UNAVAILABLE

If any of these conditions are met at the time this function is called, the callback is invoked immediately.

Example

Code Snippet
Copy_cs = finesse.clientservices.ClientServices;
_cs.registerOnDisconnectHandler(_connectionDisconnectHandler);

_connectionDisconnectHandler = function () {
 // Perform the logic 
}

Parameters

Name

Type

Description

Required

handler

Function

The function that is invoked when the conditions are met. Registers only one handler at a time. Handlers registered earlier are overwritten.

Yes