Top Level Namespace
Defined Under Namespace
Classes: Account, Agent, AssertionError, Connection, IncomingMessage
Constant Summary collapse
- LOG =
Logger.new(STDOUT)
- DEFAULT_TIMEOUT =
5
Instance Method Summary collapse
-
#account(label, audience) ⇒ Object
Builds an ‘Account` instance.
-
#agent(label, account) ⇒ Object
Builds an ‘Agent` instance.
-
#assert(value) ⇒ Object
Raises unless the given argument is truthy.
-
#connect(host: 'localhost', port: 1883, mode: 'default', agent:, api_version: 'v1', **kwargs) ⇒ Object
Connects to the broker and subscribes to the client’s inbox topics.
Instance Method Details
#account(label, audience) ⇒ Object
Builds an ‘Account` instance.
196 197 198 |
# File 'lib/ulms_client.rb', line 196 def account(label, audience) Account.new(label, audience) end |
#agent(label, account) ⇒ Object
Builds an ‘Agent` instance.
191 192 193 |
# File 'lib/ulms_client.rb', line 191 def agent(label, account) Agent.new(label, account) end |
#assert(value) ⇒ Object
Raises unless the given argument is truthy.
186 187 188 |
# 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) ⇒ Object
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.
211 212 213 214 215 216 |
# 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 |