Arcana::Client
WebSocket client for connecting to an Arcana bus server.
Connects to ws://host:port/bus, joins with an address, then becomes a full bus participant — send, publish, subscribe, and receive pushed envelopes in real time via the on_message handler.
client = Arcana::Client.new( url: "ws://localhost:19118/bus", address: "shoppe:storefront", # services: owner:capability name: "Shoppe", description: "Print-on-demand storefront generator", tags: ["storefront", "print-on-demand"], )
client.on_message do |envelope| # handle the envelope; reply via client.send(envelope.reply(...)) end
client.connect # blocks: runs the receive loop
For pure consumers (code that uses services but doesn't expose any),
pass listed: false so the directory doesn't show an entry that's
never meant to be addressed:
client = Arcana::Client.new( url: "ws://localhost:19118/bus", address: "wow-io", # plain agent name listed: false, # mailbox only, no directory entry )
Constructors
Instance methods
Open the WebSocket, send the join frame, and run the receive loop.
Blocks until the connection closes. Run in a fiber (spawn { client.connect })
if you need to do other work concurrently.
Send an envelope and block until a reply with the same correlation_id arrives or the timeout expires. Returns nil on timeout.
Is this client registered as a service (vs. an agent)? If kind was set explicitly at construction, use that; otherwise fall back to the address-syntax guess.