Deprecated
Users should use @rc-ex/ws instead.
RingCentral WSG SDK
How does it work?
This SDK is powered by RingCentral Extensible SDK. RingCentral Extensible SDK has lots of extensions which could be combined to do various things. The following two extensions are used:
Instead of using this SDK, it is recommended to use RingCentral Extensible SDK directly.
Installation
yarn add ringcentral-wsg
Then you should be able to import the SDK like this:
import WSG from 'ringcentral-wsg';
Usage
Install RingCentral SDK v4
yarn add @ringcentral/sdk
Initialization
import {SDK} from '@ringcentral/sdk';
import WSG from 'ringcentral-wsg';
const sdk = new SDK({server, clientId, clientSecret});
await sdk.platform().login({username, extension, password});
const wsg = new WSG(sdk, {
restOverWebSocket: true, // optional, default value: false
debugMode: false; // optional, default value: false
autoRecover: true; // optional, default value: true
});
await wsg.init(); // don't forget this!
Subscription
await wsg.subscribe(
['/restapi/v1.0/account/~/extension/~/message-store'],
event => { console.log(event); }
);
For more detail, please check this test case.
Rest API
This WSG SDK is powered by RingCentral Extensible SDK.
You can access the extensible sdk by wsg.rc
:
const extInfo = await wsg.rc.restapi().account().extension().get();
For more detail, please check this test case.