Namespace: chat

QB. chat

Namespaces

dialog
helpers
message
muc
privacylist
roster

Methods

staticQB.chat.connect(params, callback)

modules/chat/qbChat.js, line 657
self.connection to the chat. More info.
Name Type Description
params Object Connect to the chat parameters
Name Type Description
userId Number Connect to the chat by user id (use instead params.email and params.jid)
jid String Connect to the chat by user jid (use instead params.userId and params.email)
email String Connect to the chat by user's email (use instead params.userId and params.jid)
password String The user's password or session token
callback chatConnectCallback The chatConnectCallback callback

staticQB.chat.disconnect()

modules/chat/qbChat.js, line 1212
Logout from the Chat. More info.

staticQB.chat.getLastUserActivity(jid_or_user_id)

modules/chat/qbChat.js, line 1181
Send query to get last user activity by QB.chat.onLastUserActivityListener(userId, seconds). More info.
Name Type Description
jid_or_user_id Number | String The user id or jid, that the last activity we want to know

staticQB.chat.onConfirmSubscribeListener(userId)

modules/chat/qbChat.js, line 242
Receive confirm request. More info.
Name Type Description
userId Number The sender ID

staticQB.chat.onContactListListener(userId, type)

modules/chat/qbChat.js, line 227
Receive user status (online / offline). More info.
Name Type Description
userId Number The sender ID
type String If user leave the chat, type will be 'unavailable'

staticQB.chat.onDeliveredStatusListener(messageId, dialogId, userId)

modules/chat/qbChat.js, line 178
Receive delivery confirmations More info.
Name Type Description
messageId String Delivered message id
dialogId String The dialog id
userId Number User id

staticQB.chat.onDisconnectedListener()

modules/chat/qbChat.js, line 264
Run after disconnect from chat. More info.

staticQB.chat.onJoinOccupant(dialogId, userId)

modules/chat/qbChat.js, line 211
You will receive this callback when some user joined group chat dialog you are in.
Name Type Description
dialogId String An id of chat dialog that user joined.
userId Number An id of user who joined chat dialog.

staticQB.chat.onKickOccupant(dialogId, initiatorUserId)

modules/chat/qbChat.js, line 203
You will receive this callback when you are in group chat dialog(joined) and other user (chat dialog's creator) removed you from occupants.
Name Type Description
dialogId String An id of chat dialog where you was kicked from.
initiatorUserId Number An id of user who has kicked you.

staticQB.chat.onLastUserActivityListener(userId, seconds)

modules/chat/qbChat.js, line 256
Receive user's last activity (time ago). More info.
Name Type Description
userId Number The user's ID which last activity time we receive
seconds Number Time ago (last activity in seconds or 0 if user online or undefined if user never registered in chat)

staticQB.chat.onLeaveOccupant(dialogId, userId)

modules/chat/qbChat.js, line 219
You will receive this callback when some user left group chat dialog you are in.
Name Type Description
dialogId String An id of chat dialog that user left.
userId Number An id of user who left chat dialog.

staticQB.chat.onMessageErrorListener(messageId, error)

modules/chat/qbChat.js, line 153
Blocked entities receive an error when try to chat with a user in a 1-1 chat and receivie nothing in a group chat. More info.
Name Type Description
messageId Number The message id
error Object The error object

staticQB.chat.onMessageListener(userId, message)

modules/chat/qbChat.js, line 145
You need to set onMessageListener function, to get messages. More info.
Name Type Description
userId Number Sender id
message Object The message model object

staticQB.chat.onMessageTypingListener(isTyping, userId, dialogId)

modules/chat/qbChat.js, line 169
Show typing status in chat or groupchat. More info.
Name Type Description
isTyping Boolean Typing Status (true - typing, false - stop typing)
userId Number Typing user id
dialogId String The dialog id

staticQB.chat.onReadStatusListener(messageId, dialogId, userId)

modules/chat/qbChat.js, line 187
You can manage 'read' notifications in chat. More info.
Name Type Description
messageId String Read message id
dialogId String The dialog id
userId Number User Id

staticQB.chat.onReconnectListener()

modules/chat/qbChat.js, line 270
By default Javascript SDK reconnects automatically when connection to server is lost. More info.

staticQB.chat.onRejectSubscribeListener(userId)

modules/chat/qbChat.js, line 249
Receive reject request. More info.
Name Type Description
userId Number The sender ID

staticQB.chat.onSentMessageCallback(messageLost, messageSent)

modules/chat/qbChat.js, line 161
This feature defines an approach for ensuring is the message delivered to the server. This feature is unabled by default. More info.
Name Type Description
messageLost Object The lost message model object (Fail)
messageSent Object The sent message model object (Success)

staticQB.chat.onSubscribeListener(userId)

modules/chat/qbChat.js, line 235
Receive subscription request. More info.
Name Type Description
userId Number The sender ID

staticQB.chat.onSystemMessageListener(message)

modules/chat/qbChat.js, line 196
These messages work over separated channel and won't be mixed with the regular chat messages. More info.
Name Type Description
message Object The system message model object. Always have type: 'headline'

staticQB.chat.send(jid_or_user_id, message){String}

modules/chat/qbChat.js, line 945
Send message to 1 to 1 or group dialog. More info.
Name Type Description
jid_or_user_id String | Number Use opponent id or jid for 1 to 1 chat, and room jid for group chat.
message Object The message object.
Returns:
Type Description
String messageId - The current message id (was generated by SDK)

staticQB.chat.sendIsStopTypingStatus(jid_or_user_id)

modules/chat/qbChat.js, line 1082
Send is stop typing status. More info.
Name Type Description
jid_or_user_id String | Number Use opponent id or jid for 1 to 1 chat, and room jid for group chat.

staticQB.chat.sendIsTypingStatus(jid_or_user_id)

modules/chat/qbChat.js, line 1055
Send is typing status. More info.
Name Type Description
jid_or_user_id String | Number Use opponent id or jid for 1 to 1 chat, and room jid for group chat.

staticQB.chat.sendReadStatus(params)

modules/chat/qbChat.js, line 1148
Send is read status. More info.
Name Type Description
params Object Object of parameters
Name Type Description
userId Number The receiver id
messageId Number The delivered message id
dialogId Number The dialog id

staticQB.chat.sendSystemMessage(jid_or_user_id, message){String}

modules/chat/qbChat.js, line 1007
Send system message (system notification) to 1 to 1 or group dialog. More info.
Name Type Description
jid_or_user_id String | Number Use opponent id or jid for 1 to 1 chat, and room jid for group chat.
message Object The message object.
Returns:
Type Description
String messageId - The current message id (was generated by SDK)