This repository has been archived by the owner on Aug 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f208c06
commit 9a24c39
Showing
26 changed files
with
374 additions
and
1,246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
use crate::handlers::response::handle_response; | ||
use crate::rpc::enums::AuthorizeKind; | ||
use futures::stream::SplitSink; | ||
use warp::ws::{Message, WebSocket}; | ||
use axum::extract::ws::Message; | ||
|
||
pub async fn handle_authorize(request: AuthorizeKind, tx: &mut SplitSink<WebSocket, Message>) { | ||
pub async fn handle_authorize(request: AuthorizeKind) { | ||
match request { | ||
AuthorizeKind::Request(req) => { | ||
handle_response(Message::text(serde_json::to_string(&req).unwrap()), tx).await; | ||
handle_response(Message::Text(serde_json::to_string(&req).unwrap())).await; | ||
} | ||
_ => { | ||
handle_response(Message::text("Got response"), tx).await; | ||
handle_response(Message::Text("Got response".into())).await; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,8 @@ | ||
use futures::stream::SplitSink; | ||
use futures::SinkExt; | ||
use axum::extract::ws::Message; | ||
use pretty_env_logger; | ||
use tracing::info; | ||
|
||
use log::error; | ||
use log::info; | ||
use warp::ws::{Message, WebSocket}; | ||
|
||
pub async fn handle_error(error: Message, tx: &mut SplitSink<WebSocket, Message>) { | ||
pub async fn handle_error(error: Message) { | ||
info!("Entered error_handler"); | ||
match tx.send(error).await { | ||
Ok(_) => (), | ||
Err(e) => { | ||
error!( | ||
"websocket error: Could not send error response. Error: ({})", | ||
e | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.