This package provides an IrisClient which can be used to communicate with an Iris server using the gRPC protocol and Node.js. With the exception of the Close
method, which finishes immediately, the methods of IrisClient make use of Promises to return response objects.
Used to obtain a new IrisClient object.
constructor(serverAddress, caFile) {...}
Creates a unidirectional stream from the gRPC to this client. You may pass in a function errorCallback
to be called if there is an error with the gRPC server stream. The returned promise object contains the session identifier.
connect(errorCallback) {...}
Cleans up the client's connection and nulls out some of the variables the client uses.
close() {...}
Makes a gRPC request to set the value for the given key on the specified source. Returns a promise object that contains the value that was set.
setValue(source, key, value) {...}
Makes a gRPC request to retrieve the value for the given key on the specified source. Returns a promise object that contains the returned value.
getValue(source, key) {...}
Makes a gRPC request to remove the key-value pair for the given key on the specified source. Returns a promise object that contains the session identifier as well as the source and key of the removed value.
removeValue(source, key) {...}
Makes a gRPC request to remove the source and any key-value pairs contained within it. Returns a promise object that contains the session identifier as well as the identifier of the removed source.
removeSource(source) {...}
Makes a gRPC request to retrieve an array of identifiers for known sources. Returns a promised array of source identifiers.
getSources() {...}
Makes a gRPC request to retrieve an array of keys for the given source. Returns a promised array of keys contained in the given source.
getKeys(source) {...}
Makes a gRPC request indicating that the client wishes to receive all updates for the given source. This method expects to receive a callback function handler
that will be invoked when an update is received for this source. Subscribe returns a promsied object that contains the session identifier as well as the identifier of the subscribed source.
subscribe(source, handler) {...}
Makes a gRPC request indicating that this client wishes to receive all updates for the given source and key. This method expects to receive a callback function handler
that will be invoked when an update is received for this source and key. SubscribeKey returns a promised object that contains the session identifier, the identifier of the subscribed source, and the key that was subscribed to.
subscribeKey(source, key, handler) {...}
Makes a gRPC request indicating that the client should stop realying updates for the given source to the specified handler. Unsubscribe returns a promised object containing the session identifier and the identifier of the unsubscribed source.
unsubscribe(source, handler) {...}
Makes a gRPC request indicating that the client should stop realying updates for the given source and key to the specified handler. UnsubscribeKey returns a promised object containing the session identifier and the identifier of the unsubscribed source.
unsubscribeKey(source, key, handler) {...}