Skip to main content

Send values in a message

The dialog of the Endpoint Control node holds the server and the login. A message can change these values, and more, while the flow runs.

The properties of the message​

PropertyTypeUse
msg.actionstringconnect, disconnect, reset, get, validate or status
msg.configobjectthe values to change (Connect and Check only)
msg.modestringmerge (the default) or replace. See Advanced settings
msg.ifRevisionnumberConnect, Check and Reset. See Advanced settings
  • The node reads msg.action only when the Action is "Let the message decide".
  • Reset, Disconnect, Get the settings and Get the status use no value of msg.config. A message for one of them with a msg.config that is not empty gets an error message on config. The node then does nothing.
  • An empty msg.config ({}, null or "") counts as no msg.config. A flow can attach one to every message.
  • A Reset with msg.mode gets an error message on mode. A reset always uses all the endpoint settings again.

The fields of msg.config​

The fields have the names of the fields of the OpcUa-Endpoint2 node.

FieldValue
endpointthe server address: opc.tcp://host:port/path
securityModeNone, Sign or SignAndEncrypt
securityPolicyfor example Basic256Sha256
userIdentityTypethe login: Anonymous, UserName or Certificate
userName, passwordfor UserName
userCertificate, userPrivatekey, userPrivatekeyPassphrasefor Certificate, as PEM text. See The password and the certificate
maxRetry, initialDelay, maxDelayintegers. See Advanced settings
namespaceAliasesthe alias table. See Advanced settings
subscriptionssome parameters of the subscriptions. See Advanced settings

A field that is not in this list gets an error message on that field. Some settings never change by a message: see Safety.

Example​

msg.action = "connect";
msg.config = {
endpoint: "opc.tcp://line-b:4840",
securityMode: "SignAndEncrypt",
securityPolicy: "Basic256Sha256",
userIdentityType: "UserName",
userName: "operator",
password: "secret"
};
return msg;

A value in the message replaces the value in the dialog​

For Connect, Check and Let the message decide, the node makes one set of values from the dialog and the message.

  1. A value in msg.config replaces the value in the dialog.
  2. A value in the dialog replaces the value in use.
  3. When neither has a value, the node keeps the value in use (mode merge), or uses the value of the endpoint (mode replace).

A blank value ("" or null) counts as no value.

FieldRule
endpoint, securityMode, securityPolicythe rule above
the login fieldssee "The login is one group" below
maxRetry, initialDelay, maxDelayone by one: the message, then the value in use or the value of the endpoint
namespaceAliasesthe table of the message as a whole, else the table in use or the table of the endpoint
subscriptionsby id, parameter by parameter: the message, then the value in use or the value of the endpoint
modemsg.mode, else merge
ifRevisionmsg.ifRevision only

The node checks the result as it checks a message that carries all of it. The order is:

  1. the licence, for Connect and Reset only. The node checks it before it reads the values.
  2. the checks of the values: msg.mode, msg.ifRevision, then the fields.
  3. Allowed servers, on the server address that results (the address of the dialog included).
  4. the server: it must accept a TCP connection. Then the node asks the server for its list of connection options (GetEndpoints). For Connect, no answer to GetEndpoints gives only a warning.
  5. the switch, with a time limit. After a failure, the node uses the previous settings again.

The first step that fails stops the action. Check runs the steps 2 to 4 and changes nothing. It gives the result that Connect gives for the same values.

A Connect with no value, neither in the message nor in the dialog, connects again with the settings in use.

The login is one group​

The login fields are userIdentityType, userName, password, userCertificate, userPrivatekey and userPrivatekeyPassphrase.

  • If the message carries userIdentityType, the login of the message replaces the login of the dialog as a whole. The user name of the dialog is not used.
  • If the message carries only secrets, they complete the login of the dialog. The dialog gives the type and the user name.
  • If neither the message nor the dialog gives userIdentityType, a message with a login field gets an error message on userIdentityType.
  • The new login replaces the whole old login. The node deletes the old password when the login changes to another type.
  • A field that does not belong to the type gets an error message on that field. Example: a password with Anonymous.
  • A blank field ("" or null, as a form sends it) that does not belong to the type counts as absent.
  • A blank userName, password, userCertificate or userPrivatekey of the chosen type gets an error message.
  • A blank endpoint, securityMode, securityPolicy or retry field counts as absent.
  • When the server address changes to another host or port, the message must carry userIdentityType. The node does not keep the old login for a new server.

Let the message decide​

With the Action "Let the message decide", the node reads the action from a property of the message. The default property is msg.action. You can set another name in the text field of the Action, for example payload.command.

  • The value must be one of connect, disconnect, reset, get, validate and status. The match is exact, in lower case.
  • A missing value, or another value, gets an error message on action. It lists the valid values.

With any other Action, the node ignores msg.action. The first message with another msg.action gets a warning in the log of the node, once.