Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Initializes chat service and establishes socket.io connection with CTLive server.

Parameters:

Name

Mandatory

Type

Description

myself

Status
colourRed
titleyes

Status
titleobject

An object containing user info.

sessionToken

Status
colourRed
titleNO

Status
titleSTRING

sessionToken return by RestAPI CTLive Agent Login and Logout via Rest API

(Needed only if login is not done using JS SDK)

domain

Status
titleno

Status
titlestring

Unique domain identifier

enableVideo

Status
titleno

Status
titleboolean

Flag to enable video operations for the agent

Returns:

Type

Description

JS Promise

An empty Javascript Promise

Example:

Code Block
languagejs
LIVECHAT.init().then(
  var myself = {
  "nickname": "Agent1",
  "isAgent": true,
  "id": "USER_AGENT1",
  "channel": "web"
}
LIVECHAT.login(myself)
.then(function() {
 
  console.log("[CTLIVE] Initialization completed successfully");
  },
  )
.catch(function() {
 
  console.log("[CTLIVE] [ERROR] Initialization failed");

 }
);