init(data)
Initializates the Lobby for a user and opens a socket connection.
data Object
id
String: User idtoken
String: User tokenreturn Promise
getUserChats()
Gets the user active chats.
return Array of Chat objects.
close()
Disconnects from server.
addEventListener(type, callback)
Add a listener to a Lobby event.
type
String: The event namecallback
Function: Callback to be executed when the event occurs'system:info'
Event triggered when a system information is received. It will trigger when a chat is converted to ticket. Carries the following object:
{
"chatId": "<chatId>",
"data": {
"ticketId": "PROJECTCODE-12345678",
"rawTicketId": "12345678"
},
"duplicate": false,
"execution_time": 0.17465996742249,
"success": true
}
'chat:remove'
Executes when a chat should be removed. Carries the following object:
{
"userId": "<userId>",
"chatId": "<chatId>"
}
chats
Array of chat objects that are currently active.
logged
Whether the user is logged or not