Skip to content

Conversation

@marisradu
Copy link

Problem

Currently, AbsintheClient.WebSocket only passes the :timeout option from :connect_options to the underlying Mint WebSocket connection. This limits users who need to configure other transport-level options, such as SSL verification settings.

Solution

Modified run_ws_options/1 to extract and pass through all transport_opts from :connect_options to Slipstream's mint_opts, while maintaining the default 30,000ms timeout for backwards compatibility.

Use Cases

This change enables several important scenarios:

  1. Development/Testing: Disable SSL verification for local testing
   connect_options: [transport_opts: [verify: :verify_none]]
  1. Production SSL: Custom certificates and certificate authorities
   connect_options: [
     transport_opts: [
       verify: :verify_peer,
       cacertfile: "/path/to/ca.pem"
     ]
   ]
  1. mTLS: Client certificate authentication
   connect_options: [
     transport_opts: [
       certfile: "/path/to/client-cert.pem",
       keyfile: "/path/to/client-key.pem"
     ]
   ]
  1. Performance Tuning: Socket-level options
   connect_options: [
     transport_opts: [
       nodelay: true,
       keepalive: true
     ]
   ]

Changes

  • Extract full transport_opts keyword list from :connect_options
  • Pass all transport options to Slipstream configuration
  • Maintain default 30,000ms timeout if not specified

Testing

  • ✅ Existing tests pass
  • ✅ Manually tested with SSL disabled
  • ✅ Backwards compatible with existing code
  • ✅ Tested with erlang 27.1.2 / elixir 1.19.1-otp-27

Backwards Compatibility

✅ Fully backwards compatible - existing code continues to work unchanged

- Extract full transport_opts keyword list from connect_options
- Pass all transport options to Slipstream configuration
- Maintain default 30,000ms timeout for backwards compatibility
- Enables SSL configuration, mTLS, and other transport-level options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant