Page MenuHomePhabricator

D10945.id36628.diff
No OneTemporary

D10945.id36628.diff

diff --git a/services/identity/src/websockets/mod.rs b/services/identity/src/websockets/mod.rs
--- a/services/identity/src/websockets/mod.rs
+++ b/services/identity/src/websockets/mod.rs
@@ -11,7 +11,7 @@
use hyper_tungstenite::HyperWebsocket;
use identity_search_messages::{
ConnectionInitializationResponse, ConnectionInitializationStatus, Heartbeat,
- Messages, SearchQuery, SearchResult, User,
+ MessagesToServer, SearchQuery, SearchResult, User,
};
use serde::{Deserialize, Serialize};
use tokio::net::TcpListener;
@@ -171,16 +171,17 @@
text: String,
outgoing: WebsocketSink,
) -> Result<(), errors::WebsocketError> {
- let Ok(serialized_message) = serde_json::from_str::<Messages>(&text) else {
+ let Ok(serialized_message) = serde_json::from_str::<MessagesToServer>(&text)
+ else {
return Err(errors::WebsocketError::SerializationError);
};
match serialized_message {
- Messages::Heartbeat(Heartbeat {}) => {
+ MessagesToServer::Heartbeat(Heartbeat {}) => {
debug!("Received heartbeat");
Ok(())
}
- Messages::SearchQuery(search_request) => {
+ MessagesToServer::SearchQuery(search_request) => {
let search_result = match search_request {
SearchQuery::Prefix(prefix_request) => {
handle_prefix_search(&prefix_request.prefix).await
diff --git a/shared/identity_search_messages/src/messages/mod.rs b/shared/identity_search_messages/src/messages/mod.rs
--- a/shared/identity_search_messages/src/messages/mod.rs
+++ b/shared/identity_search_messages/src/messages/mod.rs
@@ -1,4 +1,4 @@
-//! Messages sent from client to Identity Search Server
+//! Messages sent between Client and Identity Search Server
pub mod auth_messages;
pub mod search_query;
@@ -15,10 +15,16 @@
#[derive(Debug, Serialize, Deserialize)]
#[serde(untagged)]
-pub enum Messages {
+pub enum MessagesToClient {
+ ConnectionInitializationResponse(ConnectionInitializationResponse),
+ SearchResult(SearchResult),
+ Heartbeat(Heartbeat),
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum MessagesToServer {
AuthMessage(AuthMessage),
SearchQuery(SearchQuery),
Heartbeat(Heartbeat),
- ConnectionInitializationResponse(ConnectionInitializationResponse),
- SearchResult(SearchResult),
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 6:13 AM (20 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2675638
Default Alt Text
D10945.id36628.diff (2 KB)

Event Timeline