in src/rpc.ts [98:117]
constructor(private readonly options: IRPCOptions) {
super();
this.unsubscribeCallback = (options.receiver || defaultRecievable).readMessages(this.listener);
// Both sides will fire "ready" when they're set up. When either we get
// a ready or the other side successfully responds that they're ready,
// resolve the "ready" promise.
this.isReady = new Promise<void>(resolve => {
const response = { protocolVersion: options.protocolVersion || '1.0' };
this.expose('ready', () => {
resolve();
return response;
});
this.call<void>('ready', response)
.then(resolve)
.catch(resolve);
});
}