Radix Relay
Hybrid mesh communications with Signal Protocol encryption
Loading...
Searching...
No Matches
radix_relay::nostr::protocol::event Struct Reference

Nostr EVENT message wrapper. More...

#include <protocol.hpp>

Public Member Functions

auto serialize () const -> std::string
 Serializes event to JSON string.
 

Static Public Member Functions

static auto from_event_data (const event_data &evt) -> event
 Creates an event message from event_data.
 
static auto deserialize (const std::string &json) -> std::optional< event >
 Deserializes event from JSON.
 

Public Attributes

std::string subscription_id
 Subscription this event matches.
 
event_data data
 The event itself.
 

Detailed Description

Nostr EVENT message wrapper.

Wraps event_data with subscription ID for relay-to-client communication.

Definition at line 212 of file protocol.hpp.

Member Function Documentation

◆ deserialize()

static auto radix_relay::nostr::protocol::event::deserialize ( const std::string &  json) -> std::optional< event >
static

Deserializes event from JSON.

Parameters
jsonJSON string
Returns
Parsed event or std::nullopt on failure

◆ from_event_data()

static auto radix_relay::nostr::protocol::event::from_event_data ( const event_data evt) -> event
static

Creates an event message from event_data.

Parameters
evtEvent data to wrap
Returns
Constructed event message

Referenced by radix_relay::nostr::message_handler< Bridge >::handle(), radix_relay::nostr::message_handler< Bridge >::handle(), and radix_relay::nostr::message_handler< Bridge >::handle().

◆ serialize()

auto radix_relay::nostr::protocol::event::serialize ( ) const -> std::string

Serializes event to JSON string.

Returns
JSON string in format ["EVENT", subscription_id, event_data]

Member Data Documentation

◆ data

event_data radix_relay::nostr::protocol::event::data

The event itself.

Definition at line 215 of file protocol.hpp.

◆ subscription_id

std::string radix_relay::nostr::protocol::event::subscription_id

Subscription this event matches.

Definition at line 214 of file protocol.hpp.


The documentation for this struct was generated from the following file: