Page MenuHomePhabricator

D10945.diff
No OneTemporary

D10945.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
@@ -12,7 +12,7 @@
use identity_search_messages::{
ConnectionInitializationResponse, ConnectionInitializationStatus, Heartbeat,
IdentitySearchFailure, IdentitySearchMethod, IdentitySearchResponse,
- IdentitySearchResult, IdentitySearchUser, Messages,
+ IdentitySearchResult, IdentitySearchUser, MessagesToServer,
};
use serde::{Deserialize, Serialize};
use tokio::net::TcpListener;
@@ -177,16 +177,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::IdentitySearchQuery(search_query) => {
+ MessagesToServer::IdentitySearchQuery(search_query) => {
let handler_result = match search_query.search_method {
IdentitySearchMethod::IdentitySearchPrefix(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),
+ IdentitySearchResponse(IdentitySearchResponse),
+ Heartbeat(Heartbeat),
+}
+
+#[derive(Debug, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum MessagesToServer {
IdentitySearchAuthMessage(IdentitySearchAuthMessage),
IdentitySearchQuery(IdentitySearchQuery),
Heartbeat(Heartbeat),
- ConnectionInitializationResponse(ConnectionInitializationResponse),
- IdentitySearchResponse(IdentitySearchResponse),
}

File Metadata

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

Event Timeline