This allowed us to use AWS ELB with TLS termination.
We just copied _select_next_server(self)
and modified around lines 47 and 59 (define and add ssl
params at line 59).
A better solution would be change the default NATS client (in the main package):
- have a
default_dialer()
method that wraps theasyncio.open_connection()
call - add a
custom_dialer
parameter in the__init__()
constructor.self.dialer
should be set toself.default_dialer
ifcustom_dialer is None
. - call
self.dialer()
instead ofasyncio.open_connection()
.
Note that for the go client, the same thing is feasible by defining a CustomDialer and add it to the Options before opts.connect()