mirror of
https://github.com/denoland/deno.git
synced 2024-12-11 18:17:48 -05:00
fix: increase websocket message size (#15406)
This commit is contained in:
parent
967b7f8b5b
commit
18b5debc3f
1 changed files with 21 additions and 4 deletions
|
@ -40,12 +40,13 @@ use tokio::net::TcpStream;
|
|||
use tokio_rustls::rustls::RootCertStore;
|
||||
use tokio_rustls::rustls::ServerName;
|
||||
use tokio_rustls::TlsConnector;
|
||||
use tokio_tungstenite::client_async;
|
||||
use tokio_tungstenite::client_async_with_config;
|
||||
use tokio_tungstenite::tungstenite::handshake::client::Response;
|
||||
use tokio_tungstenite::tungstenite::protocol::frame::coding::CloseCode;
|
||||
use tokio_tungstenite::tungstenite::protocol::CloseFrame;
|
||||
use tokio_tungstenite::tungstenite::protocol::Message;
|
||||
use tokio_tungstenite::tungstenite::protocol::Role;
|
||||
use tokio_tungstenite::tungstenite::protocol::WebSocketConfig;
|
||||
use tokio_tungstenite::MaybeTlsStream;
|
||||
use tokio_tungstenite::WebSocketStream;
|
||||
|
||||
|
@ -84,8 +85,16 @@ pub async fn ws_create_server_stream(
|
|||
state: &Rc<RefCell<OpState>>,
|
||||
transport: hyper::upgrade::Upgraded,
|
||||
) -> Result<ResourceId, AnyError> {
|
||||
let ws_stream =
|
||||
WebSocketStream::from_raw_socket(transport, Role::Server, None).await;
|
||||
let ws_stream = WebSocketStream::from_raw_socket(
|
||||
transport,
|
||||
Role::Server,
|
||||
Some(WebSocketConfig {
|
||||
max_message_size: Some(128 << 20),
|
||||
max_frame_size: Some(32 << 20),
|
||||
..Default::default()
|
||||
}),
|
||||
)
|
||||
.await;
|
||||
let (ws_tx, ws_rx) = ws_stream.split();
|
||||
|
||||
let ws_resource = WsStreamResource {
|
||||
|
@ -322,7 +331,15 @@ where
|
|||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
let client = client_async(request, socket);
|
||||
let client = client_async_with_config(
|
||||
request,
|
||||
socket,
|
||||
Some(WebSocketConfig {
|
||||
max_message_size: Some(128 << 20),
|
||||
max_frame_size: Some(32 << 20),
|
||||
..Default::default()
|
||||
}),
|
||||
);
|
||||
let (stream, response): (WsStream, Response) =
|
||||
if let Some(cancel_resource) = cancel_resource {
|
||||
client.or_cancel(cancel_resource.0.to_owned()).await?
|
||||
|
|
Loading…
Reference in a new issue