new CapabilityExchange(subSession)
Controller class to send query and handle response.
Parameters:
Name | Type | Description |
---|---|---|
subSession |
Object | the subSession(for example: wsc.Call) object. |
Methods
-
enquiry(selfCapability, target)
-
Send a capability enquiry message.
Parameters:
Name Type Description selfCapability
String The initiator's capability of this enquiry.
target
String The target user identity of this enquiry.
-
respond(Query, selfCapability)
-
Send a capability enquiry response message.
Parameters:
Name Type Description Query
Query An object contains the query information; this function will respond for the enquiry represented by this object.
selfCapability
String The capability to respond.
Events
-
onError
-
Event handler that is called when an error message is received. For example, the enquiry target is not reachable, or the enquiry request has timed out and so on.
Parameters:
Name Type Description Error
Object An error object that contains the properties "action", "errorCode" and "errorReason".
-
onQueryRequest
-
Event handler that is called when the capability enquiry request is received. And an object contains the enquiry information will be passed to the application. This Query object contains properties like initiator, target, initiatorCapability, targetCapability.
Parameters:
Name Type Description Query
Query An object that represents a capability enquiry.
-
onQueryResponse
-
Event handler called when the capability enquiry response is received. And an object that contains the enquiry information will be passed to application. This Query object contains properties like initiator, target, initiatorCapability, targetCapability.
Parameters:
Name Type Description Query
Query An object that represents a capability query.