WebsockexAdapter.Examples.AdapterSupervisor (WebsockexAdapter v0.1.1)

View Source

Supervisor for WebSocket adapters with fault tolerance.

This supervisor manages adapter GenServers alongside the ClientSupervisor, creating a robust supervision tree where:

  • ClientSupervisor manages Client GenServers
  • AdapterSupervisor manages adapter GenServers
  • Adapters monitor their Clients and handle reconnection

Example

children = [
  {WebsockexAdapter.ClientSupervisor, []},
  {WebsockexAdapter.Examples.AdapterSupervisor, [
    adapters: [
      {DeribitGenServerAdapter, [
        name: :deribit_main,
        client_id: "...",
        client_secret: "..."
      ]},
      {DeribitGenServerAdapter, [
        name: :deribit_backup,
        url: "wss://www.deribit.com/ws/api/v2",
        client_id: "...",
        client_secret: "..."
      ]}
    ]
  ]}
]

Supervisor.start_link(children, strategy: :one_for_one)

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)