Skip to content

Commit

Permalink
feat: expose subscription id field (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakowskiii authored Jun 15, 2023
1 parent ebe8582 commit 7b49fc4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions relay_client/src/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<str>,
pub tag: u32,
Expand All @@ -84,11 +85,12 @@ pub struct PublishedMessage {

impl PublishedMessage {
fn from_request(request: &InboundRequest<Subscription>) -> 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,
Expand Down

0 comments on commit 7b49fc4

Please sign in to comment.