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, 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).
 

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)

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.