Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3486850
D10945.id37014.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.id37014.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
@@ -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
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 19, 6:13 AM (21 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2675523
Default Alt Text
D10945.id37014.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