@@ -3,7 +3,7 @@ use crate::shared::{ConnectionId, SessionId, Task, TaskResponse, TaskResponseCon
3
3
use futures_util:: { SinkExt , StreamExt } ;
4
4
use std:: { collections:: HashMap , sync:: Arc } ;
5
5
use tokio_tungstenite:: {
6
- connect_async_with_config,
6
+ connect_async_with_config, tungstenite ,
7
7
tungstenite:: protocol:: { Message , WebSocketConfig } ,
8
8
} ;
9
9
@@ -56,28 +56,29 @@ impl ClientWorker {
56
56
log:: info!( "Connecting to {address_request} ..." ) ;
57
57
let ( mut stream_request, _) = connect_async_with_config (
58
58
address_request. clone ( ) ,
59
- Some ( WebSocketConfig {
60
- max_send_queue : None ,
61
- write_buffer_size : 0 ,
62
- max_write_buffer_size : usize :: MAX ,
63
- max_message_size : None ,
64
- max_frame_size : Some ( MB * 512 ) ,
65
- accept_unmasked_frames : true ,
66
- } ) ,
59
+ Some (
60
+ WebSocketConfig :: default ( )
61
+ . write_buffer_size ( 0 )
62
+ . max_message_size ( None )
63
+ . max_frame_size ( Some ( MB * 512 ) )
64
+ . accept_unmasked_frames ( true )
65
+ . read_buffer_size ( 64 * 1024 ) // 64 KiB (previous default)
66
+ ) ,
67
67
true ,
68
68
)
69
69
. await
70
70
. expect ( "Failed to connect" ) ;
71
71
let ( mut stream_response, _) = connect_async_with_config (
72
72
address_response,
73
- Some ( WebSocketConfig {
74
- max_send_queue : None ,
75
- write_buffer_size : 0 ,
76
- max_write_buffer_size : usize:: MAX ,
77
- max_message_size : None ,
78
- max_frame_size : Some ( MB * 512 ) ,
79
- accept_unmasked_frames : true ,
80
- } ) ,
73
+ Some (
74
+ WebSocketConfig :: default ( )
75
+ . write_buffer_size ( 0 )
76
+ . max_message_size ( None )
77
+ . max_frame_size ( Some ( MB * 512 ) )
78
+ . accept_unmasked_frames ( true )
79
+ . read_buffer_size ( 64 * 1024 ) // 64 KiB (previous default)
80
+
81
+ ) ,
81
82
true ,
82
83
)
83
84
. await
@@ -87,7 +88,7 @@ impl ClientWorker {
87
88
88
89
// Init the connection.
89
90
let session_id = SessionId :: new ( ) ;
90
- let bytes = rmp_serde:: to_vec ( & Task :: Init ( session_id) ) . expect ( "Can serialize tasks to bytes." ) ;
91
+ let bytes: tungstenite :: Bytes = rmp_serde:: to_vec ( & Task :: Init ( session_id) ) . expect ( "Can serialize tasks to bytes." ) . into ( ) ;
91
92
stream_request. send ( Message :: Binary ( bytes. clone ( ) ) ) . await . expect ( "Can send the message on the websocket." ) ;
92
93
stream_response. send ( Message :: Binary ( bytes) ) . await . expect ( "Can send the message on the websocket." ) ;
93
94
@@ -129,7 +130,7 @@ impl ClientWorker {
129
130
ClientRequest :: WithoutCallback ( task) => task,
130
131
131
132
} ;
132
- let bytes = rmp_serde:: to_vec ( & task) . expect ( "Can serialize tasks to bytes." ) ;
133
+ let bytes = rmp_serde:: to_vec ( & task) . expect ( "Can serialize tasks to bytes." ) . into ( ) ;
133
134
stream_request. send ( Message :: Binary ( bytes) ) . await . expect ( "Can send the message on the websocket." ) ;
134
135
}
135
136
} ) ;
0 commit comments