Jive Realtime Events SDK
Parse Realtime messages to feed a Call State Machine
Getting started
Installation
npm install --save @jive/realtime-events
Example
import { ICallEventsAdapter, RealtimeManager, Call } from '@jive/realtime-events';
const adapter: ICallEventsAdapter = {
startIncomingCall: (call: Call) => {
console.log('Receiving Incoming Call');
},
startIncomingConversation: (call: Call) => {
console.log('Answered to an incoming call');
},
timeoutIncomingCall: (call: Call) => {
console.log('Does not answer to an incoming call');
},
startOutgoingCall: (call: Call) => {
console.log('Executing an Outgoing call');
},
startOutgoingConversation: (call: Call) => {
console.log('Recipient picked up the call');
},
timeoutOutgoingCall: (call: Call) => {
console.log('Recipient has not picked up the call');
},
endConversation: (call: Call) => {
console.log('The call is ended');
}
};
const manager = new RealtimeManager(accessToken, adapter);
manager.start();
const line = {
id: '267c0d06-2ff2-4dcb-857b-2b7123467b84',
number: '1234',
name: 'Yann Renaudin',
organizationId: '0127d974-f9f3-0704-2dee-000100420001'
};
manager.addSubscription(line);
Docs
1. State Machine
2. Realtime Manager
3. Adapters