Example:
<!DOCTYPE html>
<html lang="">
<head>
<script src="https://cc-sdk.itniotech.com/sip-sdk.js"></script>
</head>
<body>
<!-- sdk Component -->
<cc-sdk id="sdk"></cc-sdk>
<script type="module">
import http from 'axios'
//1. In order to ensure the security of authentication information, the customer system backend service needs to implement SDK authentication capabilities and expose the interface to the customer frontend for use. The customer backend system access authentication capability document can be seen (https://www.itniotech.com/api/call/ccsdkAuthentication/)
//2. The 'https://xxx.xx.cn/createAuth' path needs to be replaced with the customer system backend interface
//3. Overall request path description: [Customer system frontend]->[Customer backend interface]->[Our API interface]
//4. SDK registration only requires one line of code window.ccSdk.register({token:xxx}). The post request sent in the example below is only for reference. The purpose is to obtain token from the backend interface. The specific implementation logic can be customized
http.post('url', res => {
window.ccSdk.register({
token: res.data,
})
})
</script>
</body>
</html>
Event Handling
Listening to SDK Agent Status. To listen to the status of the SDK agent, add an ID to the SDK component and use addEventListener to listen for the onSeatStatus callback, e.g.,