Remove unnecessary Box from WebSocket messages.

This commit is contained in:
Sunli 2021-03-09 12:07:12 +08:00
parent 0f2a2b5dbd
commit d0fe7fc23b
2 changed files with 8 additions and 10 deletions

View File

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
- Remove unnecessary Box from WebSocket messages.
## [2.5.11] - 2021-03-07
- Execute `_entity` requests in parallel. [#431](https://github.com/async-graphql/async-graphql/issues/431)

View File

@ -265,14 +265,8 @@ impl Protocols {
#[inline]
fn next_message<'s>(&self, id: &'s str, payload: Response) -> ServerMessage<'s> {
match self {
Protocols::SubscriptionsTransportWS => ServerMessage::Data {
id,
payload: Box::new(payload),
},
Protocols::GraphQLWS => ServerMessage::Next {
id,
payload: Box::new(payload),
},
Protocols::SubscriptionsTransportWS => ServerMessage::Data { id, payload },
Protocols::GraphQLWS => ServerMessage::Next { id, payload },
}
}
}
@ -322,12 +316,12 @@ enum ServerMessage<'a> {
/// subscriptions-transport-ws protocol next payload
Data {
id: &'a str,
payload: Box<Response>,
payload: Response,
},
/// graphql-ws protocol next payload
Next {
id: &'a str,
payload: Box<Response>,
payload: Response,
},
// Not used by this library, as it's not necessary to send
// Error {