View Source GraphQLWSClient.Config (GraphQL-over-Websocket Client v0.1.4)

A struct containing the configuration for a client.

Link to this section Summary

Functions

Builds a new config.

Link to this section Types

@type t() :: %GraphQLWSClient.Config{
  backoff_interval: non_neg_integer(),
  connect_on_start: boolean(),
  connect_timeout: timeout(),
  driver: module() | {module(), Keyword.t() | %{optional(atom()) => any()}},
  host: String.t(),
  init_payload: any(),
  init_timeout: timeout(),
  path: String.t(),
  port: :inet.port_number(),
  upgrade_timeout: timeout()
}

Link to this section Functions

@spec new(opts :: t() | Keyword.t() | map()) :: t()

Builds a new config.

options

Options

  • :backoff_interval - The number of milliseconds to wait before trying to reconnect to the server.

  • :connect_on_start - Determines whether to immediately connect to the server as soon as the client is started. When set to false, you need to manually connect by calling GraphQLWSClient.open/1. Defaults to true.

  • :connect_timeout - The connection timeout. Defaults to 5000.

  • :driver - The driver module to use. Defaults to GraphQLWSClient.Drivers.Gun.

  • :host - The host to connect to. This is ignored when :url is specified instead.

  • :init_payload - The payload send together with the connection_init message. Is useful when you need to authenticate a connection with a token, for instance.

  • :init_timeout - The number of milliseconds to wait for a connection_ack after initiating the connection. Defaults to 5000.

  • :path - The path on the server. This is ignored when :url is specified instead. Defaults to "/".

  • :port - The port to connect to. This is ignored when :url is specified instead.

  • :upgrade_timeout - The number of milliseconds to wait for a connection upgrade. Defaults to 5000.

  • :url - The URL of the websocket to connect to. Overwrites the :host, :port and :path options.