class Object
Constants
- DEFAULT_TIMEOUT
- LOG
Public Instance Methods
account(label, audience)
click to toggle source
Builds an `Account` instance.
# File lib/ulms_client.rb, line 196 def account(label, audience) Account.new(label, audience) end
agent(label, account)
click to toggle source
Builds an `Agent` instance.
# File lib/ulms_client.rb, line 191 def agent(label, account) Agent.new(label, account) end
assert(value)
click to toggle source
Raises unless the given argument is truthy.
# File lib/ulms_client.rb, line 186 def assert(value) raise AssertionError.new("Assertion failed") unless value end
connect(host: 'localhost', port: 1883, mode: 'default', agent:, api_version: 'v1', **kwargs)
click to toggle source
Connects to the broker and subscribes to the client's inbox topics.
Options:
- `host`: The broker's host (required). - `port`: The broker's TCP port for MQTT connections (required). - `agent`: The `Agent` object (required). - `mode`: Connection mode: default | service | bridge | observer. - `api_version`: agent's API version. - `password`: If the broker has authn enalbed this requires the password for the `agent`'s account. - `clean_session`: A boolean indicating whether the broker has to clean the previos session. - `keep_alive`: Keep alive time in seconds.
# File lib/ulms_client.rb, line 211 def connect(host: 'localhost', port: 1883, mode: 'default', agent:, api_version: 'v1', **kwargs) conn = Connection.new(host: host, port: port, mode: mode, agent: agent, **kwargs) conn.connect conn.subscribe("agents/#{agent}/api/#{api_version}/in/#") conn end