absinthe_client icon indicating copy to clipboard operation
absinthe_client copied to clipboard

Feature: Support all transport_opts in connect_options for WebSocket connections

Open marisradu opened this issue 2 months ago • 0 comments

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

marisradu avatar Oct 31 '25 12:10 marisradu