ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
notification_message Struct Referencefinal

Server-initiated notification of an entity change. More...

#include <subscription_protocol.hpp>

Collaboration diagram for notification_message:
Collaboration graph

Public Member Functions

std::vector< std::byte > serialize () const
 Serialize notification to bytes.
 

Static Public Member Functions

static std::expected< notification_message, ores::utility::serialization::error_code > deserialize (std::span< const std::byte > data)
 Deserialize notification from bytes.
 

Public Attributes

std::string event_type
 The event type that occurred.
 
std::chrono::system_clock::time_point timestamp
 Timestamp of when the change occurred (UTC).
 
std::vector< std::string > entity_ids
 Identifiers of entities that changed.
 

Detailed Description

Server-initiated notification of an entity change.

This is a push message from the server to subscribed clients. It does not expect a response.

Member Function Documentation

◆ serialize()

std::vector< std::byte > serialize ( ) const

Serialize notification to bytes.

Format:

  • 2 bytes: event_type length
  • N bytes: event_type (UTF-8)
  • 8 bytes: timestamp (milliseconds since epoch, int64_t)
  • 4 bytes: entity_ids count
  • For each entity_id:
    • 2 bytes: length
    • N bytes: entity_id (UTF-8)

Member Data Documentation

◆ timestamp

std::chrono::system_clock::time_point timestamp

Timestamp of when the change occurred (UTC).

Clients can use this to query for changes since this timestamp.

◆ entity_ids

std::vector<std::string> entity_ids

Identifiers of entities that changed.

For currencies, this contains ISO codes (e.g., "USD", "EUR"). For accounts, this contains account IDs (UUIDs as strings). May be empty for bulk operations or when specific IDs are not available.