aoc-signal
v1.2.2
Published
Javascript signal sdk for AOC, this library is based on js-realtime-sdk.
Downloads
12
Readme
Javascript signal sdk for AOC, this library is based on js-realtime-sdk.
Dependencies
Installation
npm install --save aoc-signal
Usage
var signalService = new SignalService({
appId: 'xxxxxx',
appKey: 'xxxxxx'
});
const callbacks = {
onDisconnect: () => {
console.log('[disconnect] 服务器连接已断开');
},
onReconnect: () => {
console.log('[reconnect] 重连成功');
},
onReconnecterror: () => {
console.log('[reconnecterror] 重连失败');
}
};
const testRoom = {
name: 'testroom',
members: ['Tom', 'Jerry']
};
const roomCallbacks = {
onSignal: (signal) => {
}
};
signalService.login('Tom', callbacks)
.then(servie => {
return service.joinRoom(testRoom, roomCallbacks);
})
.then(room => {
return room.broadcastMsg('hello');
})
.then(signal => {
console.log(`send message success`);
})
Documentation
This project use typedoc to auto generate API document.
visit API document