@@ -7,6 +7,7 @@ use std::{
77} ;
88
99use eventsource_client as es;
10+ use launchdarkly_sdk_transport:: HyperTransport ;
1011
1112use crate :: { Config , EventType } ;
1213
@@ -102,10 +103,6 @@ impl Inner {
102103 reconnect_options = reconnect_options. delay ( Duration :: from_millis ( delay_ms) ) ;
103104 }
104105
105- if let Some ( read_timeout_ms) = config. read_timeout_ms {
106- client_builder = client_builder. read_timeout ( Duration :: from_millis ( read_timeout_ms) ) ;
107- }
108-
109106 if let Some ( last_event_id) = & config. last_event_id {
110107 client_builder = client_builder. last_event_id ( last_event_id. clone ( ) ) ;
111108 }
@@ -127,8 +124,34 @@ impl Inner {
127124 }
128125 }
129126
127+ // Build with HyperTransport
128+ let mut transport_builder = HyperTransport :: builder ( ) ;
129+
130+ if let Some ( timeout_ms) = config. read_timeout_ms {
131+ transport_builder = transport_builder. read_timeout ( Duration :: from_millis ( timeout_ms) ) ;
132+ }
133+
134+ #[ cfg( any(
135+ feature = "hyper-rustls-native-roots" ,
136+ feature = "hyper-rustls-webpki-roots" ,
137+ feature = "native-tls"
138+ ) ) ]
139+ let transport = transport_builder
140+ . build_https ( )
141+ . map_err ( |e| format ! ( "Failed to build HTTPS transport: {e:?}" ) ) ?;
142+ #[ cfg( not( any(
143+ feature = "hyper-rustls-native-roots" ,
144+ feature = "hyper-rustls-webpki-roots" ,
145+ feature = "native-tls"
146+ ) ) ) ]
147+ let transport = transport_builder
148+ . build_http ( )
149+ . map_err ( |e| format ! ( "Failed to build HTTP transport: {e:?}" ) ) ?;
150+
130151 Ok ( Box :: new (
131- client_builder. reconnect ( reconnect_options. build ( ) ) . build ( ) ,
152+ client_builder
153+ . reconnect ( reconnect_options. build ( ) )
154+ . build_with_transport ( transport) ,
132155 ) )
133156 }
134157}
0 commit comments