Constructor
new Connection()
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
onCOnnected |
function | |
onDisconnected |
function | |
onApplyErrorMessage |
function | |
onApplyDialogMessage |
function |
Connection constructor
Members
(static) STATE_CONNECTING
- Source:
- To Do:
-
- убрать обработку дерева из Connection
Methods
(async) allowScreenCast(flag)
- Source:
Send user choise for screencast request.
Parameters:
| Name | Type | Description |
|---|---|---|
flag |
bool | User choise to allow screencast. TRUE - allow, FALSE - disallow. |
(async) connectToChatroom(chatroomId)
- Source:
Connects visitor to Chatroom
Parameters:
| Name | Type | Description |
|---|---|---|
chatroomId |
string | Chatroom ID |
(async) disconnectFromChatroom(chatroomId)
- Source:
Disconnects visitor from Chatroom
Parameters:
| Name | Type | Description |
|---|---|---|
chatroomId |
string | Chatroom ID |
(async) getAllChatrooms(page, itemsPerPage)
- Source:
Gets all avaliable chatrooms ordered by title.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
page |
number |
1
|
Number of page to deliver |
itemsPerPage |
number |
100
|
Number of items per page |
(async) getChatroom(chatroomId)
- Source:
Gets Chatroom from backend
Parameters:
| Name | Type | Description |
|---|---|---|
chatroomId |
string | Chatroom ID |
(async) getChatroomHistory(chatroomId, lastKnownMessageId, count) → {Array.<Message>}
- Source:
Gets messages from specific Chatroom.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
chatroomId |
string | Chatroom ID |
|
lastKnownMessageId |
string | null |
null
|
last displayed message ID. If NULL, it will return last messages in dialog |
count |
number |
30
|
Number of messages to return. Can be between 1 and 100. |
Returns:
- Type
- Array.<Message>
(async) getChatroomMembers(chatroomId, itemsPerPage, page)
- Source:
Gets visitors from specific Chatroom. If current visitor is connected to chatroom, response may contain himself.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
chatroomId |
string | Which chatroom visitors return |
|
itemsPerPage |
number |
10
|
Number of visitors to return per page |
page |
number |
1
|
Data page number |
(async) getConnectedToConversationManagers() → {Array.<Manager>}
- Source:
Gets all connected to visitor website managers
Returns:
- Type
- Array.<Manager>
getConnectionState() → {number}
- Source:
- To Do:
-
- перепроверить. отдает 2, хотя уже подключен.
Returns current connection state as INT
Returns:
- Type
- number
getConnectionStateDescription() → {string}
- Source:
Returns current connection state as STRING
Returns:
- Type
- string
(async) getConversationHistory(lastKnownMessageId, count) → {Promise.<Array.<Message>>}
- Source:
Gets messages from dialog between visitor and managers.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
lastKnownMessageId |
string | null |
null
|
last displayed message ID. If NULL, it will return last messages in dialog |
count |
number |
30
|
Number of messages to return. Can be between 1 and 100. |
Throws:
Returns:
- Type
- Promise.<Array.<Message>>
(async) getManagerInfo(managerId) → {Promise.<Manager>}
- Source:
Gets manager infromation by his id
Parameters:
| Name | Type | Description |
|---|---|---|
managerId |
string | Manager's id |
Returns:
- Type
- Promise.<Manager>
(async) getMyChatrooms(page, itemsPerPage)
- Source:
Gets all chatrooms with current visitor ordered by title.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
page |
number |
1
|
Number of page to deliver |
itemsPerPage |
number |
100
|
Number of items per page |
(async) getNewVisitorId(websiteId) → {Promise.<string>}
- Source:
Gets new visitor ID if passed was invalid.
Parameters:
| Name | Type | Description |
|---|---|---|
websiteId |
string | Website ID from Chatix dashboard |
Returns:
- Type
- Promise.<string>
(async) getVisitorByVisitor(visitorId)
- Source:
Gets information about another visitor. It returns object similar to Visitor, but without private fields like email, fields, location, etc. If you need to receive this information, use REST API.
Parameters:
| Name | Type | Description |
|---|---|---|
visitorId |
string | Another visitor ID |
(async) getVisitorInfo() → {Visitor}
- Source:
Gets current visitor information from server
Returns:
- Type
- Visitor
(async) getWebChatInfo() → {object}
- Source:
Gets webchat config
Returns:
- Type
- object
(async) getWebChatManagers() → {Array.<Manager>}
- Source:
Gets all website managers
Returns:
- Type
- Array.<Manager>
(async) interruptScreenCast() → {void}
- Source:
Sends screencast interruption event to managers
Returns:
- Type
- void
onInvalidVisitorIdConnected()
- Source:
- To Do:
-
- ждем исправления на бэкенде
(async) sendBroadcastData() → {void}
- Source:
Sends data to screencast
Returns:
- Type
- void
(async) sendBroadcastEvent(broadcastEvent)
- Source:
Sends screencast event to consultants
Parameters:
| Name | Type | Description |
|---|---|---|
broadcastEvent |
object |
(async) sendChatroomMessage(text, chatroomId) → {Message}
- Source:
Sends text message to specific Chatroom
Parameters:
| Name | Type | Description |
|---|---|---|
text |
Message | Text to be sent to Chatroom |
chatroomId |
string | Chatroom ID where message has to be sent |
Returns:
saved message
- Type
- Message
(async) sendMessage(message) → {Message}
- Source:
Sends message to conversation
Parameters:
| Name | Type | Description |
|---|---|---|
message |
Message |
Returns:
saved message instance
- Type
- Message
(async) sendPage(url, title) → {void}
- Source:
Sends user navigation thought pages
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | current page URL |
title |
string | current page title |
Returns:
- Type
- void
(async) sendVisitorInfo(visitor) → {Visitor}
- Source:
Sends visitor details update to manager
Parameters:
| Name | Type | Description |
|---|---|---|
visitor |
Visitor |
Returns:
updated visitor entity
- Type
- Visitor
(async) sendVisitorTypedText(text) → {void}
- Source:
Sends current user input to managers
Parameters:
| Name | Type | Description |
|---|---|---|
text |
string | what user is typing |
Returns:
- Type
- void
(async) start(websiteId, visitorId) → {Promise.<void>}
- Source:
Starts connection
Parameters:
| Name | Type | Description |
|---|---|---|
websiteId |
string | Website ID from Chatix Dashboard |
visitorId |
string | Visitor ID that will be used to connect. If it is invalid, it will be replaced with new one. |
Returns:
- Type
- Promise.<void>
(async) stop()
- Source:
Interrupts connection