WebsockexNova.Gun.ConnectionOptions (WebsockexNova v0.1.0)
View SourceCentralized parsing and validation for Gun connection options.
Defaults and Security
The default transport is
:tls
(HTTPS/WSS) for secure connections.For most production APIs and public WebSocket endpoints, this is required.
If you are connecting to a local or non-TLS endpoint (e.g., localhost:80), you must override:
%{transport: :tcp, port: 80}
For self-signed certificates in development, you can use:
%{transport: :tls, transport_opts: [verify: :verify_none]}
Never use
verify: :verify_none
in production!
Example Usage
# Production (default)
{:ok, conn} = WebsockexNova.Gun.ConnectionWrapper.open("api.example.com", 443)
# Local development (plain HTTP)
{:ok, conn} = WebsockexNova.Gun.ConnectionWrapper.open("localhost", 80, %{transport: :tcp})
# Local development (self-signed HTTPS)
{:ok, conn} = WebsockexNova.Gun.ConnectionWrapper.open("localhost", 443, %{transport_opts: [verify: :verify_none]})
This module merges user options with defaults, validates required fields, and normalizes option values for consistent downstream usage.