RemoteObject🔗
-
class
RemoteObject
(config)🔗 Creates and maintains a local reflection of a remote object.
Instances of the RemoteObject class work as a control interface that create and keep up a connection to a remote server implementing the VisionAppster RPC protocol.
Creates a new RemoteObject instance.
- Arguments
config (string|RemoteObjectConfig) – Either the URL of a remote object instance or a configuration object. Most often, the url and clientId keys are used.
-
RemoteObject.
$connectedChanged
🔗 type: LocalSignal
A signal that will be emitted whenever the connection to the remote object breaks or is re-established. The signal has a single Boolean parameter indicating the current connection status.
-
RemoteObject.
$error
🔗 type: LocalSignal
A signal that will be emitted whenever an error occurs in the remote connection. The signal has a single parameter that is an instance of the Error object.
-
RemoteObject.
absoluteUrl
🔗 type: string
-
RemoteObject.
defaultMediaType
🔗 type: string
The default media type used when passing data between the client and the server unless otherwise specified e.g. by signal connection parameters.
-
RemoteObject.
object
🔗 type: AnyObject
A local object that reflects the properties and methods of a remote object. This is the same object that is returned by connect().
-
RemoteObject.
connect
()🔗 Connects to the URL given at construction and creates a local reflection of the remote object. If return channel wasn’t explicitly disabled, establishes a WebSocket connection as well.
Returns a promise that resolves with the local reflection of the remote object. If a connection has already been established or can be safely restored, returns a previously created reflection object. If the remote object identification has changed, returns a new reflection object.
- Returns
Promise<AnyObject> –
-
RemoteObject.
disconnect
()🔗 - Returns
Promise<void> –
-
RemoteObject.
header
(key)🔗 - Arguments
key (string) –
- Returns
string –
-
RemoteObject.
id
()🔗 - Returns
string –
-
RemoteObject.
isConnected
()🔗 - Returns
boolean –
-
RemoteObject.
ping
()🔗 - Returns
Promise<any> –
-
RemoteObject.
setHeader
(key, value)🔗 Adds a custom header to every HTTP request made to the server. If value is null or undefined, removes the header.
- Arguments
key (string) –
value (string) –