Spell

Spell is a WAMP client library and an application for managing WAMP peers.

Examples

See Crossbar for how to start a Crossbar.io server for interactive development.

Once up, you can connect a new peer by calling:

{:ok, peer} = Spell.connect(Crossbar.uri, realm: Crossbar.realm)

Peer Interface

The WAMP protocol defines peers which communicate by passing messages. Peers create and communicate over one to one bidirectional channels.

Use Spell.connect to create and connect a new peer to the WAMP server.

Spell delegates common client role functions to provide a single interface. See the defdelegate statements in the source or run Spell.__info__(:functions) for the full list of module functions.

WAMP Support

Spell supports the client portion of the basic WAMP profile, RC4.

Client Roles:

See Spell.Role for how to create new roles.

Transports

See Spell.Transport for how to create new transports.

Serializers

See Spell.Serizlier for how to create new serializers.

Source

Summary

call(peer, procedure)
call(peer, procedure, options)
call_goodbye(peer)
call_goodbye(peer, options)
call_publish(peer, topic)
call_publish(peer, topic, options)
call_register(peer, procedure)
call_register(peer, procedure, options)
call_subscribe(peer, topic)
call_subscribe(peer, topic, options)
call_unregister(peer, registration)
call_unsubscribe(peer, subscription)
cast_call(peer, procedure)
cast_call(peer, procedure, options)
cast_goodbye(peer)
cast_goodbye(peer, options)
cast_publish(peer, topic)
cast_publish(peer, topic, options)
cast_register(peer, procedure)
cast_register(peer, procedure, options)
cast_subscribe(peer, topic)
cast_subscribe(peer, topic, options)
cast_unregister(peer, registration)
cast_unsubscribe(peer, subscription)
cast_yield(peer, invocation)
cast_yield(peer, invocation, options)
close(peer, options \\ [])

Close the peer by sending a GOODBYE message. This call is synchronous; it blocks until receiving the acknowledging GOODBYE

connect(uri, options \\ [])

Creates and returns a new peer with an open WAMP session at uri

receive_event(peer, subscription)
receive_registered(peer, register_id)
receive_result(peer, call_id)
receive_unregistered(peer, registration)
receive_unsubscribed(peer, unsubscribe)
start(type, args)

Callback implementation for c::application.start/2

Functions

call(peer, procedure)
Source
call(peer, procedure, options)
Source
call_goodbye(peer)
Source
call_goodbye(peer, options)
Source
call_publish(peer, topic)
Source
call_publish(peer, topic, options)
Source
call_register(peer, procedure)
Source
call_register(peer, procedure, options)
Source
call_subscribe(peer, topic)
Source
call_subscribe(peer, topic, options)
Source
call_unregister(peer, registration)
Source
call_unsubscribe(peer, subscription)
Source
cast_call(peer, procedure)
Source
cast_call(peer, procedure, options)
Source
cast_goodbye(peer)
Source
cast_goodbye(peer, options)
Source
cast_publish(peer, topic)
Source
cast_publish(peer, topic, options)
Source
cast_register(peer, procedure)
Source
cast_register(peer, procedure, options)
Source
cast_subscribe(peer, topic)
Source
cast_subscribe(peer, topic, options)
Source
cast_unregister(peer, registration)
Source
cast_unsubscribe(peer, subscription)
Source
cast_yield(peer, invocation)
Source
cast_yield(peer, invocation, options)
Source
close(peer, options \\ [])

Close the peer by sending a GOODBYE message. This call is synchronous; it blocks until receiving the acknowledging GOODBYE.

Source
connect(uri, options \\ [])

Specs:

Creates and returns a new peer with an open WAMP session at uri.

Options

  • :realm :: String.t the peer’s configured realm
  • :roles = [Spell.Role.Publisher, Spell.Role.Subscriber, Spell.Role.Caller, Spell.Role.Callee] :: [module | {module, any}] the list of roles to start the client with. Each item can be the bare role’s module, or the a 2-tuple of the module and init options.
  • :retries = 5 :: integer number of times to retry connecting
  • :retry_interval = 1000 :: integer inteveral in milliseconds between retries
Source
receive_event(peer, subscription)
Source
receive_registered(peer, register_id)
Source
receive_result(peer, call_id)
Source
receive_unregistered(peer, registration)
Source
receive_unsubscribed(peer, unsubscribe)
Source
start(type, args)

Callback implementation for c::application.start/2.

Source