Options
All
  • Public
  • Public/Protected
  • All
Menu

Establish a RPC protocol on top of a given channel. By default the rpc protocol is bi-directional, meaning it is possible to send requests and notifications to the remote side (i.e. acts as client) as well as receiving requests and notifications from the remote side (i.e. acts as a server). Clients can get a promise for a remote request result that will be either resolved or rejected depending on the success of the request. Keeps track of outstanding requests and matches replies to the appropriate request Currently, there is no timeout handling for long running requests implemented. The bi-directional mode can be reconfigured using the RpcProtocolOptions to construct an RPC protocol instance that acts only as client or server instead.

Hierarchy

  • RpcProtocol

Index

Constructors

Properties

cancellationTokenSources: Map<number, CancellationTokenSource> = ...
channel: Channel
mode: "default" | "clientOnly" | "serverOnly"
nextMessageId: number = 0
onNotificationEmitter: Emitter<{ args: any[]; method: string }> = ...
pendingRequests: Map<number, Deferred<any>> = ...
requestHandler: undefined | RequestHandler
toDispose: DisposableCollection = ...
CANCELLATION_TOKEN_KEY: "add.cancellation.token" = 'add.cancellation.token'

Accessors

  • get onNotification(): Event<{ args: any[]; method: string }>

Methods

  • handleCancel(id: number): void
  • handleNotify(method: string, args: any[], id?: number): Promise<void>
  • handleReply(id: number, value: any): void
  • handleReplyErr(id: number, error: any): void
  • handleRequest(id: number, method: string, args: any[]): Promise<void>
  • sendCancel(requestId: number): void
  • sendNotification(method: string, args: any[]): void
  • sendRequest<T>(method: string, args: any[]): Promise<T>