format-sse-fix2

This commit is contained in:
Untone 2023-10-20 20:52:26 +03:00
parent 85502a694d
commit 7dd060bfdd

View File

@ -25,7 +25,7 @@ struct RedisMessageData {
action: String action: String
} }
#[derive(Serialize, Deserialize, Clone, Debug)] #[derive(Serialize, Deserialize, Clone, Debug, Display)]
pub struct SSEMessageData { pub struct SSEMessageData {
payload: HashMap<String, Value>, payload: HashMap<String, Value>,
action: String, action: String,
@ -146,7 +146,7 @@ async fn connect_handler(
let formatted_server_event = format!( let formatted_server_event = format!(
"id: {}\ndata: {}\n\n", "id: {}\ndata: {}\n\n",
event_id, event_id,
message_data server_event
); );
Some((Ok::<_, actix_web::Error>(Bytes::from(formatted_server_event)), rx)) Some((Ok::<_, actix_web::Error>(Bytes::from(formatted_server_event)), rx))