absinthe_client
absinthe_client copied to clipboard
Feature: Support all transport_opts in connect_options for WebSocket connections
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:
- Development/Testing: Disable SSL verification for local testing
connect_options: [transport_opts: [verify: :verify_none]]
- Production SSL: Custom certificates and certificate authorities
connect_options: [
transport_opts: [
verify: :verify_peer,
cacertfile: "/path/to/ca.pem"
]
]
- mTLS: Client certificate authentication
connect_options: [
transport_opts: [
certfile: "/path/to/client-cert.pem",
keyfile: "/path/to/client-key.pem"
]
]
- Performance Tuning: Socket-level options
connect_options: [
transport_opts: [
nodelay: true,
keepalive: true
]
]
Changes
- Extract full
transport_optskeyword 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