Build a new RpcProxyFactory.
Optional
target: anyThe object to expose to RPC methods calls. If this is omitted, the proxy won't be able to handle requests, only send them.
Protected
Readonly
onProtected
Readonly
onProtected
rpcProtected
rpcOptional
targetThe object to expose to RPC methods calls. If this is omitted, the proxy won't be able to handle requests, only send them.
Protected
deserializeGet a callable object that executes a RPC method call.
Getting a property on the Proxy object returns a callable that, when called, executes a RPC call. The name of the property defines the method to be called. The callable takes a variable number of arguments, which are passed in the RPC method call.
For example, if you have a Proxy object:
let fooProxyFactory = RpcProxyFactory<Foo>('/foo')
let fooProxy = fooProxyFactory.createProxy()
accessing fooProxy.bar
will return a callable that, when called,
executes a RPC method call to method bar
. Therefore, doing
fooProxy.bar()
will call the bar
method on the remote Foo object.
unused.
The property accessed on the Proxy object.
unused.
A callable that executes the RPC call.
Protected
isReturn whether the given property represents a notification.
A property leads to a notification rather than a method call if its name
begins with notify
or on
.
The property being called on the proxy.
Whether p
represents a notification.
Connect a Channel to the factory by creating an RpcProtocol on top of it.
This protocol will be used to send/receive RPC requests and responses.
Protected
onProtected
onProcess an incoming RPC method call.
onRequest is called when the RPC connection received a method call request. It calls the corresponding method on [[target]].
The return value is a Promise object that is resolved with the return value of the method call, if it is successful. The promise is rejected if the called method does not exist or if it throws.
Rest
...args: any[]A promise of the method call completion.
Protected
serializeProtected
wait
Factory for RPC proxy objects.
A RPC proxy exposes the programmatic interface of an object through Theia's RPC protocol. This allows remote programs to call methods of this objects by sending RPC requests. This takes place over a bi-directional stream, where both ends can expose an object and both can call methods on each other' exposed object.
For example, assuming we have an object of the following type on one end:
which we want to expose through a RPC interface. We would do:
The party at the other end of the
connection
, in order to remotely call methods on this object would do:One the wire, it would look like this:
Note that in the code of the caller, we didn't pass a target object to RpcProxyFactory, because we don't want/need to expose an object. If we had passed a target object, the other side could've called methods on it.