aether::message::message Class Reference

Represents messages received from an Aether process or a client. More...

#include <message.hh>

Public Member Functions

 message (const capnp::word *buffer, const size_t length)
 
std::optional< container::span< const char > > get_payload () const
 
std::optional< uint64_t > get_source_user_id () const
 
std::optional< worker_idget_source_worker () const
 
bool is_source_global_state () const
 
template<typename T >
bool payload_as_pod (T &dest) const
 Used to conditionally unpack the binary message into the given struct type. More...
 

Detailed Description

Represents messages received from an Aether process or a client.

Constructor & Destructor Documentation

aether::message::message::message ( const capnp::word *  buffer,
const size_t  length 
)

Member Function Documentation

std::optional<container::span<const char> > aether::message::message::get_payload ( ) const
Returns
the binary payload of the message
std::optional<uint64_t> aether::message::message::get_source_user_id ( ) const
Returns
user_id (player id) of the sender of the event if it was received from muxer, std::nullopt otherwise
std::optional<worker_id> aether::message::message::get_source_worker ( ) const
Returns
worker_id of the sender of the event, std::nullopt otherwise.
bool aether::message::message::is_source_global_state ( ) const
Returns
true if the message is coming from the global state process
template<typename T >
bool aether::message::message::payload_as_pod ( T &  dest) const
inline

Used to conditionally unpack the binary message into the given struct type.

Returns
true if message contained binary data and was successfully unpacked