Crossbar

The Crossbar module provides commands for configuring, starting, and stopping the Crossbar server. You might want to use it for running tests or interactive development.

Why does this module implement the GenEvent behavior? It can be hooked into the ExUnit.EventManager:

ExUnit.start(formatters: [ExUnit.CLIFormatter, Crossbar])

Useful for interactive development, the Crossbar.io server can be started by calling start:

Crossbar.start()

Crossbar.io Dependency

This module requires the Crossbar.io executable. Via pip:

pip install crossbar
Source

Summary

create_config(config \\ [])

Create the Crossbar.io config dir for config

get_auth_port(binary1)

Return the port which the crossbar raw_socket auth is listening on

get_config(transport \\ app_transport())

Get the crossbar config

get_host()

Return the crossbar host

get_path(binary1)

Get the crossbar resource path

get_port(binary1)

Return the port which the crossbar transport is listening on

get_realm()

Get the default realm

handle_event(arg1, state)

Handle the ExUnit.EventManager events. When the test suite is finished stop the crossbar server

init(args)

Initialize the GenEvent handler with opts

start(options \\ get_config())

Add an event manager with the Crossbar handler to Spell.Supervisor

start_link(options \\ get_config())

Start an event manager with the Crossbar handler

stop()

Stop the Crossbar.io server. This can only be used with start/1

uri(options \\ get_config(), transport \\ app_transport())

Get the config as a uri

uri_auth(options \\ get_config(), transport \\ app_transport())

Hack to get the auth uri

Functions

create_config(config \\ [])

Create the Crossbar.io config dir for config.

Options

  • :crossbar_path :: String.t the path to the Crossbar.io config directory.

See get_config/0 for other options.

Source
get_auth_port(binary1)

Specs:

Return the port which the crossbar raw_socket auth is listening on.

The default value of 9001 for raw_socket can be overrode using the environment variable CROSSBAR_AUTH_PORT_RS.

Source
get_config(transport \\ app_transport())

Specs:

Get the crossbar config.

Source
get_host()

Specs:

Return the crossbar host.

Source
get_path(binary1)

Specs:

Get the crossbar resource path.

Source
get_port(binary1)

Specs:

Return the port which the crossbar transport is listening on.

The default value of 8080 for websocket and 9000 for raw_socket can be overrode using the environment variables CROSSBAR_PORT_WS and CROSSBAR_PORT_RS.

Source
get_realm()

Specs:

Get the default realm.

Source
handle_event(arg1, state)

Handle the ExUnit.EventManager events. When the test suite is finished stop the crossbar server.

Source
init(args)

Specs:

  • init(Keyword.t) :: {:ok, t} | {:error, term}

Initialize the GenEvent handler with opts.

Source
start(options \\ get_config())

Specs:

  • start(Keyword.t) :: {:ok, pid} | {:error, any}

Add an event manager with the Crossbar handler to Spell.Supervisor.

Source
start_link(options \\ get_config())

Specs:

  • start_link(Keyword.t) :: {:ok, pid} | {:error, any}

Start an event manager with the Crossbar handler.

Stop the process with:

GenEvent.stop(pid)
Source
stop()

Specs:

  • stop :: :ok | {:error, any}

Stop the Crossbar.io server. This can only be used with start/1.

Source
uri(options \\ get_config(), transport \\ app_transport())

Specs:

Get the config as a uri.

Source
uri_auth(options \\ get_config(), transport \\ app_transport())

Specs:

Hack to get the auth uri.

TODO: support this as part of templating out the config file.

Source