new Chat()
Methods
-
accept(chatConfig, extHeaders)
-
Accepts the incoming chat request.
Parameters:
Name Type Description chatConfig
ChatConfig Optional. The chat is accepted with this configuration
extHeaders
JSON Optional. Extension headers
-
addParticipants(participants)
-
Add participants to the Chat object. This function is used when the target is a conference address and the client wants to setup a group chat with these participants.
Parameters:
Name Type Description participants
Array an array of participants' names
-
decline(code, reason, extHeaders)
-
Declines the incoming chat request with given code and reason.
Parameters:
Name Type Description code
Number the specified error code
reason
String the specified error reason
extHeaders
JSON extension headers
-
end(extHeaders)
-
Ends the ongoing chat.
Parameters:
Name Type Description extHeaders
JSON extension headers
-
getChatConfig() → {ChatConfig}
-
Gets the configuration of the Chat.
Returns:
the chat object's ChatConfig
- Type
- ChatConfig
-
getInitiator() → {String}
-
Gets the initiator of the Chat.
Returns:
the initiator.
- Type
- String
-
getState() → {wsc.CallState}
-
Gets the signalling state of Chat.
Returns:
state - The signalling state of the Chat
- Type
- wsc.CallState
-
getTarget() → {String}
-
Gets the target of the Chat
Returns:
the target.
- Type
- String
-
indicateTyping(isTyping)
-
Sends a typing indication message to target.
Parameters:
Name Type Description isTyping
Boolean -
send(message) → {String}
-
Sends a message through the Chat object.
Parameters:
Name Type Description message
ChatMessage the message to be sent
Returns:
the sent message ID
- Type
- String
-
setSecure(isSecure)
-
Sets the transport layer to be secure or not.
Parameters:
Name Type Description isSecure
Boolean Default value is true
-
start(chatConfig, extHeaders)
-
Start the Chat.
Parameters:
Name Type Description chatConfig
ChatConfig Optional. The configuration used to start the chat
extHeaders
JSON Optional. Extension headers
Events
-
onChatMessage
-
callback function for new incoming chat message.
Parameters:
Name Type Description message
ChatMessage The incoming chat message
-
onConnectionStateChange
-
callback function for the chat connection state changes.
Parameters:
Name Type Description state
ConnectionState the current chat connection state.
-
onMessage
-
For extensibility - Processes the received JSON message between the client and the WebRTC Session Controller server.
Application can override this method to handle the JSON message directly.Parameters:
Name Type Description msg
Object the JSON message between the client and WebRTC Session Controller server
-
onMessageSendFailure
-
message send failure callback function.
Parameters:
Name Type Description msgId
String the sent message ID
status
String the status code
reason
String the reason description
-
onMessageSendSuccess
-
message send success callback function.
Parameters:
Name Type Description msgId
String the sent message ID
-
onMessageTyping
-
callback function that indicates the peer side is typing a message.
-
onMessageTypingStop
-
Callback function that indicates the other stopped typing a message.
-
onStateChange
-
callback function for Chat signalling state changes.
Parameters:
Name Type Description state
wsc.CallState An instance of CallState object
extHeaders
JSON Optional. Extension headers