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:
- Publisher:
Spell.Role.Publisher - Subscriber:
Spell.Role.Subscriber - Caller:
Spell.Role.Caller - Callee:
Spell.Role.Callee
See Spell.Role for how to create new roles.
Transports
- WebSocket:
Spell.Transport.WebSocket - RawSocket:
Spell.Transport.RawSocket
See Spell.Transport for how to create new transports.
Serializers
- JSON:
Spell.Serializer.JSON - MessagePack:
Spell.Serializer.MessagePack
See Spell.Serializer for how to create new serializers.
Summary↑
Functions
Close the peer by sending a GOODBYE message. This call is synchronous; it blocks until receiving the acknowledging GOODBYE.
Specs:
Creates and returns a new peer with an open WAMP session at uri.
Options
:realm :: String.tthe 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 :: integernumber of times to retry connecting:retry_interval = 1000 :: integerinteveral in milliseconds between retries:timeout = 2000 :: integerconnection timeout for a peer:authentication :: Keyword.t, defaults to[]:id :: String.ttheauthidto authenticate with:schemes :: Keyword.tthe authentication schemes supported. SeeSpell.Authenticate.
Callback implementation for c::application.start/2.