diff options
| author | Matthieu <matthieu@developershouse.xyz> | 2021-09-19 18:12:41 +0400 |
|---|---|---|
| committer | Matthieu <matthieu@developershouse.xyz> | 2021-09-19 18:12:41 +0400 |
| commit | 6d3caebc79f340d26262adc2ba789b10da4108aa (patch) | |
| tree | 208e1bfe0cf036c0561555e0fc35beabfd261375 /gateway/src/client/connection/utils.rs | |
| parent | 88300c45202a228d54c1e99dd3b295ef3fb9aabd (diff) | |
shard + implementation of the payload deserialization & restructure
Diffstat (limited to 'gateway/src/client/connection/utils.rs')
| -rw-r--r-- | gateway/src/client/connection/utils.rs | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/gateway/src/client/connection/utils.rs b/gateway/src/client/connection/utils.rs deleted file mode 100644 index 49ccbcc..0000000 --- a/gateway/src/client/connection/utils.rs +++ /dev/null @@ -1,29 +0,0 @@ -use super::Connection; -use crate::client::{error_utils::GatewayError}; -use std::str::from_utf8; -use tokio_tungstenite::tungstenite::Message; - -impl Connection { - pub(crate) async fn _handle_message( - &mut self, - data: &Message, - ) -> Result<crate::client::payloads::gateway::Message, GatewayError> { - match data { - Message::Text(text) => self._handle_discord_message(&text).await, - Message::Binary(message) => { - self._handle_discord_message(from_utf8(message).unwrap()) - .await - } - _ => Err(GatewayError::from("unknown error".to_string())), - } - } - - async fn _handle_discord_message( - &mut self, - raw_message: &str, - ) -> Result<crate::client::payloads::gateway::Message, GatewayError> { - let a: Result<crate::client::payloads::gateway::Message, serde_json::Error> = serde_json::from_str(raw_message); - let message = a.unwrap(); - Ok(message) - } -} |
