Global

Methods


Session#fetch

This function can take any number of arguments. Each argument can be a string or a TopicSelector. Alternatively, an array of strings and TopicSelectors can be passed as a single argument.(selector)

Fetch the current state of one or more topics.

Fetching a topic will provide its current value without subscribing this client to that topic. The returned FetchStream will emit value events for each topic that is matched for which a fetch request can be satisfied. Once complete, the FetchStream will be closed.

Parameters:
Name Type Description
selector String | TopicSelector | Array.<String>

The topic selector to fetch

Returns:

A FetchStream that will emit the fetched values.

Type
FetchStream
Examples
// Fetch a topic's value
session.fetch("foo").on('value', function(value, path) {
    console.log("Value for topic '" + path + "' is: " + value);
});
// Fetch multiple topics, handling possible errors
session.fetch("?foo/bar.*").on({
    value : function(value, path) { ... },
    error : function(error) { ... },
    close : function() { ... }
});

Type Definitions


CloseReason

Type:
  • Object
Properties:
Name Type Description
id Number

unique id

message String

message with further details


Field

Properties:
Name Type Description
scale Number

the scale of a decimal field


Node

Properties:
Name Type Description
Node.name String

the node name

Node.min Number

the minimum number of occurences of the node within its parent

Node.max Number

the maximum number of occurences of the node within its parent

Node.isVariable Boolean

if the node has variable multiplicity, or has fixed multiplicity, i.e min != max


Record

Properties:
Name Type Description
Record.fields Array.<Field>

a list of the field definitions. There will be at least one