pony_express v0.1.0 PonyExpress.Client View Source

GenServer which initiates a TLS connection to a remote Phoenix.PubSub server and forwards the subscription across the TLS connection to a local PubSub server. Note that PubSub messages are forwarded in one direction only, from client to server.

Note: A client may be bound to a single remote server, and a single topic on a single PubSub server bound to that TCP port by the remote's PonyExpress.Daemon server.

If you need to subscribe to multiple topics, you will need to establish multiple PonyExpress.Client connections.

Usage

Typically, you will want to start the client supervised in the application supervision tree as follows (or equivalent):

DynamicSupervisor.start_child({
  SomeSupervisor,
  server: <server IP>,
  topic: "<pubsub topic>",
  pubsub_server: <pubsub>,
  ssl_opts: [
    cacertfile: <ca_certfile>
    certfile: <certfile>
    keyfile: <keyfile>
  ]})
)

the following parameters are required:

  • :pubsub_server - the atom describing the Phoenix PubSub server.
  • :topic - a string which describes the topic remotely subscribed to.
  • :ssl_opts - cerificate authority pem file, client certificate, and client key.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.