View Source GraphQLWSClient.Config (GraphQL Websocket Client v2.0.2)

A struct containing the configuration for a client.

Summary

Functions

Builds a new config.

Types

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

Functions

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

Builds a new config.

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.

  • :driver - The driver module to use. Defaults to GraphQLWSClient.Drivers.Gun. Can be either a module or a tuple in the form of {MyDriverModule, opt_a: "hello world"}. The options are passed to the driver's init/1 callback, if defined.

  • :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.

  • :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.

  • :query_timeout - The default query timeout in milliseconds. Defaults to 5000.

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