Main Entry Point for DSLinks on the Dart VM

Constructors

LinkProvider(List<String> args, String prefix, { bool isRequester: false, String command: "link", bool isResponder: true, Map<String, dynamic> defaultNodes, Map<String, dynamic> nodes, Map<String, Function> profiles, NodeProvider provider, bool enableHttp: true, bool encodePrettyJson: false, bool autoInitialize: true, bool strictOptions: false, bool exitOnFailure: true, bool loadNodesJson: true, bool strictTls: false, String defaultLogLevel: "INFO", bool savePrivateKey: true, Requester overrideRequester, Responder overrideResponder, NodeProvider nodeProvider, Map linkData, Map<String, String> commandLineOptions })

Create a Link Provider. args are the command-line arguments to pass in. prefix is the link name. isRequester specifies if you are a requester or not. isResponder specifies if you a responder or not. command is the command name for this link. Both defaultNodes and nodes specify the default nodes to initialize if a nodes.json is not present. profiles specify the profiles for this link. provider is a node provider. If it is not specified, one will be created for you. enableHttp toggles whether to enable HTTP fallbacks. encodePrettyJson specifies whether to encode pretty JSON files when writing the nodes.json autoInitialize specifies whether to initialize the link inside the constructor. strictOptions toggles allowing trailing options in the argument parser. exitOnFailure toggles exiting when the link fails. loadNodesJson specifies whether to load the nodes.json file or not. strictTls specifies if a link to a secure broker should fail, if the TLS Certificate is bad. defaultLogLevel specifies the default log level. nodeProvider is the same as provider. It is provided for backwards compatibility. commandLineOptions specifies a map of an option name to a default value, for use in expanding the command parameters.

Properties

args → List<String>

The Command-line Arguments

read / write
basePath → String

read-only
brokerUrl → String

The Broker URL

read / write
command → String

The Command Name

read / write
defaultLogLevel → String

Default Log Level.

read / write
defaultNodes → Map<String, dynamic>

Default Nodes

read / write
didInitializationFail → bool

Checks if the link object is null.

read-only
dslinkJson → Map

The dslink.json contents. This is only available after configure is called.

read / write
enableHttp → bool

Enable HTTP Fallback?

read / write
encodePrettyJson → bool

Encode Pretty JSON?

read / write
exitOnFailure → bool

Exit on Failure?

read / write
home → String

connect to user home space

read / write
isInitialized → bool

Checks if the link object is not null.

read-only
isRequester → bool

Are we a requester?

read / write
isResponder → bool

Are we a responder?

read / write

The Link Object

read / write
linkData → Map

read / write
loadNodesJson → bool

Load the nodes.json?

read / write
logTag → String

Log Tag

read / write
onRequesterReady → Future<Requester>

Completes when the requester is ready for use.

read-only
overrideRequester Requester

read / write
overrideResponder Responder

read / write
parsedArguments → ArgResults

read-only
prefix → String

The Link Name

read / write
privateKey PrivateKey

The Private Key

read / write
profiles → Map<String, Function>

Profiles

read / write
provider NodeProvider

The Node Provider

read / write
qosPersistenceEnabled → bool

persist qos2 and qos3 subscription to disk, default to false;

read-only
remotePath → String

Remote Path of Responder

read-only
requester Requester

The requester object.

read-only
savePrivateKey → bool

Save Private Key?

read / write
strictOptions → bool

Strict Options?

read / write
strictTls → bool

Strict TLS connections?

read / write
token → String

connection token

read / write
valuePersistenceEnabled → bool

persist value setting to disk, default to true;

read-only
hashCode → int

The hash code for this object.

read-only, inherited
runtimeType → Type

A representation of the runtime type of the object.

read-only, inherited

Operators

operator [](String path) LocalNode

Gets the node specified at path.

operator ~() LocalNode

Gets the root node.

operator ==(other) → bool

The equality operator.

inherited

Methods

addCommandLineOption(String name, [ String defaultValue = "" ]) → void

addNode(String path, Map m) LocalNode

Adds a node with the given configuration in m at the given path. In order for this method to work, the node provider must be mutable. If you did not specify a custom node provider, the created provider is mutable.

chooseBroker(Stream<String> brokers) → Future<String>

A Method that a Custom Link Provider can override for changing how to choose a broker. By default this selects the first broker available.

close() → void

Closes the link by disconnecting from the broker. You can call connect again once you have closed a link.

configure({ArgParser argp, OptionResultsHandler optionsHandler }) → bool

Configure the link. If argp is provided for argument parsing, it is used. This includes:

connect() → Future

Connects the link to the broker.

getCommandLineValue(String name) → String

getConfig(String key) → Object

Gets a configuration value from the dslink.json

getNode(String path) LocalNode

Gets the node at the specified path.

init() → void

Initializes the Link. There is no guarantee that the link will be ready when this method returns. If the configure method is not called prior to calling this method, it is called.

loadNodesFile() → void

onNodesDeserialized(Map json) → void

Handles deserialization of node data.

onValueChange(String path, { int cacheLevel: 1 }) → Stream<ValueUpdate>

Retrieves a Broadcast Stream which subscribes to path with the specified cacheLevel. The node is only subscribed if there is at least one stream subscription. When the stream subscription count goes to 0, the node is unsubscribed from.

removeNode(String path) → void

Removes the method at the specified path. In order for this method to work, the node provider must be mutable. If you did not specify a custom node provider, the created provider is mutable.

save() → void

Synchronously saves the nodes.json file.

saveAsync() → Future

Asynchronously saves the nodes.json file.

stop() → void

An alias to close.

syncValue(String path) → void

Gets the value for path and forcibly updates the value to the same exact value.

updateValue(String path, value) → void

Updates the value of the node at the given path to value. In order for this method to work, the node provider must be mutable. If you did not specify a custom node provider, the created provider is mutable.

val(String path, [ value = unspecified ]) → dynamic

If only path is specified, this method fetches the value of the node at the given path. If value is also specified, it will set the value of the node at the given path to the specified value, and return that value.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() → String

Returns a string representation of this object.

inherited