From 7b49fc420bb402e8793b6fc0caeca5d4ba9d194e Mon Sep 17 00:00:00 2001 From: Rakowskiii <38994251+Rakowskiii@users.noreply.github.com> Date: Thu, 15 Jun 2023 13:47:02 +0200 Subject: [PATCH] feat: expose subscription id field (#28) --- relay_client/src/websocket.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/relay_client/src/websocket.rs b/relay_client/src/websocket.rs index 37b71a0..2e9a4ef 100644 --- a/relay_client/src/websocket.rs +++ b/relay_client/src/websocket.rs @@ -74,7 +74,8 @@ mod stream; /// The message received from a subscription. #[derive(Debug)] pub struct PublishedMessage { - pub id: MessageId, + pub message_id: MessageId, + pub subscription_id: SubscriptionId, pub topic: Topic, pub message: Arc, pub tag: u32, @@ -84,11 +85,12 @@ pub struct PublishedMessage { impl PublishedMessage { fn from_request(request: &InboundRequest) -> Self { - let data = &request.data().data; + let Subscription { id, data } = request.data(); let now = chrono::Utc::now(); Self { - id: request.id(), + message_id: request.id(), + subscription_id: id.clone(), topic: data.topic.clone(), message: data.message.clone(), tag: data.tag,