new ChatPackage(session, packageType)
Parameters:
Name | Type | Description |
---|---|---|
session |
Object | an instance of wsc.Session. |
packageType |
String | The name of package. If not provided, default value is 'chat'. |
Methods
-
close()
-
Close the package, all the package managed chats will be ended.
-
createChat(target) → {wsc.Chat}
-
Creates a Chat.
Parameters:
Name Type Description target
String the name of the target.
Returns:
an instance of Chat
- Type
- wsc.Chat
-
getChats() → {Array}
-
Gets all the Chat objects managed by this package.
Returns:
an array of Chat objects managed by this Package.
- Type
- Array
-
prepareChat(session, target) → {wsc.Chat}
-
For extensibility - Builds a wsc.Chat and returns it.
This function may be overridden by an extended ChatPackage to create an extended Chat object.Parameters:
Name Type Description session
wsc.Session an instance of {wsc.Session}.
target
String the name of target.
Returns:
an instance of Chat.
- Type
- wsc.Chat
Events
-
onIncomingChat
-
Callback function for the incoming chat request.
Parameters:
Name Type Description chat
wsc.Chat an instance of wsc.Chat object.
-
onMessage
-
For extensibility - Processes the received JSON message between the client and WebRTC Session Controller server.
This function handles the received messages, and dispatches messages to corresponding wsc.Chat objects. The application can override this method to handle the JSON message directly.Parameters:
Name Type Description msg
JSON the JSON message between client and WebRTC Session Controller server.