@@ -7,8 +7,8 @@ pub use tokio_tungstenite::tungstenite::ClientRequestBuilder;
77
88use super :: handler:: WebSocketProxy ;
99use super :: types:: {
10- ClientMessageFilter , FirstMessageTransformer , InitialMessage , OnCloseCallback ,
11- ResponseTransformer ,
10+ ClientBinaryMessageMapper , ClientMessageFilter , FirstMessageTransformer , InitialMessage ,
11+ OnCloseCallback , ResponseTransformer ,
1212} ;
1313use crate :: config:: DEFAULT_CONNECT_TIMEOUT_MS ;
1414use crate :: provider_selector:: SelectedProvider ;
@@ -38,6 +38,7 @@ pub struct WebSocketProxyBuilder<S = NoUpstream> {
3838 connect_timeout : Duration ,
3939 on_close : Option < OnCloseCallback > ,
4040 client_message_filter : Option < ClientMessageFilter > ,
41+ client_binary_message_mapper : Option < ClientBinaryMessageMapper > ,
4142}
4243
4344impl Default for WebSocketProxyBuilder < NoUpstream > {
@@ -51,6 +52,7 @@ impl Default for WebSocketProxyBuilder<NoUpstream> {
5152 connect_timeout : Duration :: from_millis ( DEFAULT_CONNECT_TIMEOUT_MS ) ,
5253 on_close : None ,
5354 client_message_filter : None ,
55+ client_binary_message_mapper : None ,
5456 }
5557 }
5658}
@@ -66,6 +68,7 @@ impl<S> WebSocketProxyBuilder<S> {
6668 connect_timeout : self . connect_timeout ,
6769 on_close : self . on_close ,
6870 client_message_filter : self . client_message_filter ,
71+ client_binary_message_mapper : self . client_binary_message_mapper ,
6972 }
7073 }
7174
@@ -79,6 +82,7 @@ impl<S> WebSocketProxyBuilder<S> {
7982 connect_timeout : Duration ,
8083 on_close : Option < OnCloseCallback > ,
8184 client_message_filter : Option < ClientMessageFilter > ,
85+ client_binary_message_mapper : Option < ClientBinaryMessageMapper > ,
8286 ) -> WebSocketProxy {
8387 let control_message_types = if control_message_types. is_empty ( ) {
8488 None
@@ -95,6 +99,7 @@ impl<S> WebSocketProxyBuilder<S> {
9599 connect_timeout,
96100 on_close,
97101 client_message_filter,
102+ client_binary_message_mapper,
98103 )
99104 }
100105
@@ -145,6 +150,11 @@ impl<S> WebSocketProxyBuilder<S> {
145150 self . client_message_filter = Some ( filter) ;
146151 self
147152 }
153+
154+ pub fn client_binary_message_mapper ( mut self , mapper : ClientBinaryMessageMapper ) -> Self {
155+ self . client_binary_message_mapper = Some ( mapper) ;
156+ self
157+ }
148158}
149159
150160impl WebSocketProxyBuilder < NoUpstream > {
@@ -209,6 +219,7 @@ impl WebSocketProxyBuilder<WithUrl> {
209219 self . connect_timeout ,
210220 self . on_close ,
211221 self . client_message_filter ,
222+ self . client_binary_message_mapper ,
212223 ) )
213224 }
214225}
0 commit comments