Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3486734
D10945.id37619.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10945.id37619.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 5:49 AM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2675108
Default Alt Text
D10945.id37619.diff (2 KB)
Attached To
Mode
D10945: [identity] [shared] Separate identity search messages into client and server messages
Attached
Detach File
Event Timeline
Log In to Comment