Page MenuHomePhabricator

D10945.id36867.diff
No OneTemporary

D10945.id36867.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, Failure,
- Heartbeat, Messages, SearchMethod, SearchQuery, SearchResponse, SearchResult,
+ Heartbeat, MessagesToServer, SearchMethod, SearchResponse, SearchResult,
User,
};
use serde::{Deserialize, Serialize};
@@ -176,16 +176,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_query) => {
+ MessagesToServer::SearchQuery(search_query) => {
let handler_result = match search_query.search_method {
SearchMethod::Prefix(prefix_query) => {
handle_prefix_search(&search_query.id, prefix_query).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),
+ SearchResponse(SearchResponse),
+ Heartbeat(Heartbeat),
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum MessagesToServer {
AuthMessage(AuthMessage),
SearchQuery(SearchQuery),
Heartbeat(Heartbeat),
- ConnectionInitializationResponse(ConnectionInitializationResponse),
- SearchResponse(SearchResponse),
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 5:41 AM (20 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2675523
Default Alt Text
D10945.id36867.diff (2 KB)

Event Timeline