symple

May 15, 2026 ยท View on GitHub

{#symplemodule}

symple

Realtime messaging protocol for presence, rooms, and WebRTC signalling.

Namespaces

NameDescription
smplSymple protocol messages, peers, client, and server helpers.

{#smpl}

smpl

Symple protocol messages, peers, client, and server helpers.

Classes

NameDescription
ClientSymple v4 client.
CommandSymple command message with a node path and action verb.
EventSymple event message carrying a named occurrence with a timestamp.
FormInteractive form with pages, sections, and fields for command data exchange.
FormElementBase element within a Symple form.
FormFieldForm input field with typed values and selectable options.
MessageBase Symple protocol message with addressing, status, data, and notes.
PeerSymple peer record containing identity, presence, and custom fields.
PresenceSymple presence message indicating a peer's online status.
RosterThe Roster provides a registry for active network peers indexed by session ID.
ServerSymple v4 server.
ServerPeerPer-connection state for a connected Symple peer.
AddressThe Address structure is an endpoint identifier for a peer on the network. The format is like so: user|id
ClientStateClient connection states.

{#client-5}

Client

#include <icy/symple/client.h>
class Client

Defined in src/symple/include/icy/symple/client.h:88

Inherits: Stateful< ClientState >, Signal< void(IPacket &)>

Symple v4 client.

Connects to a Symple server over plain WebSocket (no Socket.IO). Handles authentication, presence, roster management, rooms, and message routing.

Usage: smpl::Client client({ .host = "localhost", .port = 4500, .user = "alice", .name = "Alice" }); client.start();

client += packetSlot(&handler, &Handler::onMessage); client.Announce += slot(&handler, &Handler::onAnnounce);

Messages are emitted as polymorphic IPacket via PacketSignal:

Use packetSlot() with the specific type to filter.

List of all members

NameKindOwner
AnnouncevariableDeclared here
PeerConnectedvariableDeclared here
PeerDisconnectedvariableDeclared here
CreatePresencevariableDeclared here
ClientfunctionDeclared here
ClientfunctionDeclared here
startfunctionDeclared here
stopfunctionDeclared here
sendfunctionDeclared here
sendfunctionDeclared here
respondfunctionDeclared here
sendPresencefunctionDeclared here
sendPresencefunctionDeclared here
joinRoomfunctionDeclared here
leaveRoomfunctionDeclared here
isOnlinefunctionDeclared here
ourIDfunctionDeclared here
ourPeerfunctionDeclared here
roomsfunctionDeclared here
rosterfunctionDeclared here
optionsfunctionDeclared here
setOptionsfunctionDeclared here
setErrorfunctionDeclared here
createPresencefunctionDeclared here
onPresenceDatafunctionDeclared here
_datavariableDeclared here
doConnectfunctionDeclared here
onTransportErrorfunctionDeclared here
onSocketRecvfunctionDeclared here
onSocketClosefunctionDeclared here
onSocketErrorfunctionDeclared here
onWelcomefunctionDeclared here
onServerMessagefunctionDeclared here
startReconnectfunctionDeclared here
resetfunctionDeclared here
syncDesiredRoomsfunctionDeclared here
sendJsonfunctionDeclared here
buildUrlfunctionDeclared here
StateChangevariableInherited from Stateful
_statevariableInherited from Stateful
StatefulfunctionInherited from Stateful
~StatefulfunctionInherited from Stateful
stateEqualsfunctionInherited from Stateful
stateBetweenfunctionInherited from Stateful
statefunctionInherited from Stateful
statefunctionInherited from Stateful
beforeStateChangefunctionInherited from Stateful
onStateChangefunctionInherited from Stateful
setStatefunctionInherited from Stateful
setStatefunctionInherited from Stateful

Inherited from Stateful

KindNameDescription
variableStateChangeSignals when the state changes.
variable_state
functionStateful inline
function~Stateful virtual inline
functionstateEquals virtual const inlineReturns true if the current state ID equals the given ID.
functionstateBetween virtual const inlineReturns true if the current state ID is in the inclusive range [lid, rid].
functionstate virtual inlineReturns a mutable reference to the current state.
functionstate virtual const inlineReturns a copy of the current state.
functionbeforeStateChange virtual inlineOverride to handle pre state change logic. Return false to prevent state change.
functiononStateChange virtual inlineOverride to handle post state change logic.
functionsetState virtual inlineSets the state and sends the state signal if the state change was successful.
functionsetState virtual inlineSets the state and sends the state signal if the state change was successful.

Public Attributes

ReturnNameDescription
Signal< void(const int &)>AnnounceAuthentication response status (200 = success, 401 = failed).
Signal< void(Peer &)>PeerConnectedA peer has come online.
Signal< void(Peer &)>PeerDisconnectedA peer has gone offline.
Signal< void(Peer &)>CreatePresenceModify the outgoing peer object before presence broadcast.

{#announce}

Announce

Signal< void(const int &)> Announce

Defined in src/symple/include/icy/symple/client.h:174

Authentication response status (200 = success, 401 = failed).


{#peerconnected}

PeerConnected

Signal< void(Peer &)> PeerConnected

Defined in src/symple/include/icy/symple/client.h:177

A peer has come online.


{#peerdisconnected}

PeerDisconnected

Signal< void(Peer &)> PeerDisconnected

Defined in src/symple/include/icy/symple/client.h:180

A peer has gone offline.


{#createpresence}

CreatePresence

Signal< void(Peer &)> CreatePresence

Defined in src/symple/include/icy/symple/client.h:183

Modify the outgoing peer object before presence broadcast.

Public Methods

ReturnNameDescription
Client
ClientDefault constructor with default Options.
voidstartStart the Symple client.
voidstopStop the Symple client.
ssize_tsend virtualSend a Symple message. Sets the from field automatically.
ssize_tsend virtualSend a string message (parsed as JSON).
ssize_trespond virtualSwap to/from and send.
ssize_tsendPresence virtualBroadcast presence to joined rooms.
ssize_tsendPresence virtualSend directed presence to a specific peer.
intjoinRoom virtualJoin a room on the server.
intleaveRoom virtualLeave a room on the server.
boolisOnline const nodiscardReturn true if in Online state.
std::stringourID const nodiscardReturn the session ID assigned by the server.
Peer *ourPeer nodiscardReturn the local peer object (null if offline).
StringVecrooms const nodiscardReturn joined rooms.
Roster &roster nodiscardReturn the roster of online peers.
const Options &options const nodiscardReturn the current client options.
voidsetOptionsReplace the client options while the client is closed. This is the only supported way to reconfigure a default-constructed client.
voidsetErrorSet an error and transition to Error state.

{#client-6}

Client

Client(const Options & options, uv::Loop * loop = uv::defaultLoop())

Defined in src/symple/include/icy/symple/client.h:110


{#client-7}

Client

Client()

Defined in src/symple/include/icy/symple/client.h:112

Default constructor with default Options.


{#start-16}

start

void start()

Defined in src/symple/include/icy/symple/client.h:116

Start the Symple client.


{#stop-13}

stop

void stop()

Defined in src/symple/include/icy/symple/client.h:119

Stop the Symple client.


{#send-17}

send

virtual

virtual ssize_t send(Message & message)

Defined in src/symple/include/icy/symple/client.h:123

Send a Symple message. Sets the from field automatically.


{#send-18}

send

virtual

virtual ssize_t send(const std::string & message)

Defined in src/symple/include/icy/symple/client.h:126

Send a string message (parsed as JSON).


{#respond-1}

respond

virtual

virtual ssize_t respond(Message & message)

Defined in src/symple/include/icy/symple/client.h:129

Swap to/from and send.


{#sendpresence}

sendPresence

virtual

virtual ssize_t sendPresence(bool probe = false)

Defined in src/symple/include/icy/symple/client.h:132

Broadcast presence to joined rooms.


{#sendpresence-1}

sendPresence

virtual

virtual ssize_t sendPresence(const Address & to, bool probe = false)

Defined in src/symple/include/icy/symple/client.h:135

Send directed presence to a specific peer.


{#joinroom}

joinRoom

virtual

virtual int joinRoom(const std::string & room)

Defined in src/symple/include/icy/symple/client.h:138

Join a room on the server.


{#leaveroom}

leaveRoom

virtual

virtual int leaveRoom(const std::string & room)

Defined in src/symple/include/icy/symple/client.h:141

Leave a room on the server.


{#isonline}

isOnline

const nodiscard

[[nodiscard]] bool isOnline() const

Defined in src/symple/include/icy/symple/client.h:144

Return true if in Online state.


{#ourid}

ourID

const nodiscard

[[nodiscard]] std::string ourID() const

Defined in src/symple/include/icy/symple/client.h:147

Return the session ID assigned by the server.


{#ourpeer}

ourPeer

nodiscard

[[nodiscard]] Peer * ourPeer()

Defined in src/symple/include/icy/symple/client.h:150

Return the local peer object (null if offline).


{#rooms}

rooms

const nodiscard

[[nodiscard]] StringVec rooms() const

Defined in src/symple/include/icy/symple/client.h:153

Return joined rooms.


{#roster}

roster

nodiscard

[[nodiscard]] Roster & roster()

Defined in src/symple/include/icy/symple/client.h:156

Return the roster of online peers.


{#options-12}

options

const nodiscard

[[nodiscard]] const Options & options() const

Defined in src/symple/include/icy/symple/client.h:159

Return the current client options.


{#setoptions}

setOptions

void setOptions(Options options)

Defined in src/symple/include/icy/symple/client.h:164

Replace the client options while the client is closed. This is the only supported way to reconfigure a default-constructed client.

Exceptions

  • std::logic_error if the client is currently connecting, online, or reconnecting.

{#seterror-6}

setError

void setError(const std::string & error)

Defined in src/symple/include/icy/symple/client.h:167

Set an error and transition to Error state.

Protected Methods

ReturnNameDescription
voidcreatePresence virtualUnderlying connection state changed. Inherits StateChange from Stateful.
voidonPresenceData virtual

{#createpresence-1}

createPresence

virtual

virtual void createPresence(Presence & p)

Defined in src/symple/include/icy/symple/client.h:189

Underlying connection state changed. Inherits StateChange from Stateful.


{#onpresencedata}

onPresenceData

virtual

virtual void onPresenceData(const json::Value & data, bool whiny = false)

Defined in src/symple/include/icy/symple/client.h:190

Private Attributes

ReturnNameDescription
std::unique_ptr< ClientData >_data

{#_data-1}

_data

std::unique_ptr< ClientData > _data

Defined in src/symple/include/icy/symple/client.h:209

Private Methods

ReturnNameDescription
voiddoConnect
voidonTransportError
voidonSocketRecv
voidonSocketClose
voidonSocketError
voidonWelcome
voidonServerMessage
voidstartReconnect
voidreset
voidsyncDesiredRooms
ssize_tsendJson
std::stringbuildUrl const

{#doconnect}

doConnect

void doConnect()

Defined in src/symple/include/icy/symple/client.h:195


{#ontransporterror}

onTransportError

void onTransportError(const icy::Error & error)

Defined in src/symple/include/icy/symple/client.h:196


{#onsocketrecv-9}

onSocketRecv

void onSocketRecv(const std::string & data)

Defined in src/symple/include/icy/symple/client.h:197


{#onsocketclose-6}

onSocketClose

void onSocketClose()

Defined in src/symple/include/icy/symple/client.h:198


{#onsocketerror-4}

onSocketError

void onSocketError(const std::string & error)

Defined in src/symple/include/icy/symple/client.h:199


{#onwelcome}

onWelcome

void onWelcome(const json::Value & msg)

Defined in src/symple/include/icy/symple/client.h:200


{#onservermessage}

onServerMessage

void onServerMessage(const json::Value & msg)

Defined in src/symple/include/icy/symple/client.h:201


{#startreconnect}

startReconnect

void startReconnect()

Defined in src/symple/include/icy/symple/client.h:202


{#reset-15}

reset

void reset()

Defined in src/symple/include/icy/symple/client.h:203


{#syncdesiredrooms}

syncDesiredRooms

void syncDesiredRooms()

Defined in src/symple/include/icy/symple/client.h:204


{#sendjson}

sendJson

ssize_t sendJson(const json::Value & msg)

Defined in src/symple/include/icy/symple/client.h:206


{#buildurl}

buildUrl

const

std::string buildUrl() const

Defined in src/symple/include/icy/symple/client.h:207

{#options-13}

Options

#include <icy/symple/client.h>
struct Options

Defined in src/symple/include/icy/symple/client.h:93

Connection and authentication options for the Symple client.

List of all members

NameKindOwner
hostvariableDeclared here
portvariableDeclared here
securevariableDeclared here
reconnectionvariableDeclared here
reconnectAttemptsvariableDeclared here
reconnectDelayvariableDeclared here
uservariableDeclared here
namevariableDeclared here
typevariableDeclared here
tokenvariableDeclared here
OptionsfunctionDeclared here

Public Attributes

ReturnNameDescription
std::stringhost
uint16_tport
boolsecureUse wss:// instead of ws://.
boolreconnectionAuto-reconnect on disconnect.
intreconnectAttempts0 = unlimited
intreconnectDelayMilliseconds between retries.
std::stringuserUser identifier (required).
std::stringnameDisplay name.
std::stringtypePeer type.
std::stringtokenAuth token (optional).

{#host-2}

host

std::string host = "127.0.0.1"

Defined in src/symple/include/icy/symple/client.h:95


{#port-2}

port

uint16_t port = 4500

Defined in src/symple/include/icy/symple/client.h:96


{#secure-1}

secure

bool secure = false

Defined in src/symple/include/icy/symple/client.h:97

Use wss:// instead of ws://.


{#reconnection}

reconnection

bool reconnection = true

Defined in src/symple/include/icy/symple/client.h:98

Auto-reconnect on disconnect.


{#reconnectattempts}

reconnectAttempts

int reconnectAttempts = 0

Defined in src/symple/include/icy/symple/client.h:99

0 = unlimited


{#reconnectdelay}

reconnectDelay

int reconnectDelay = 3000

Defined in src/symple/include/icy/symple/client.h:100

Milliseconds between retries.


{#user-1}

user

std::string user

Defined in src/symple/include/icy/symple/client.h:102

User identifier (required).


{#name-12}

name

std::string name

Defined in src/symple/include/icy/symple/client.h:103

Display name.


{#type-19}

type

std::string type

Defined in src/symple/include/icy/symple/client.h:104

Peer type.


{#token}

token

std::string token

Defined in src/symple/include/icy/symple/client.h:105

Auth token (optional).

Public Methods

ReturnNameDescription
OptionsDefaulted constructor.

{#options-14}

Options

Options() = default

Defined in src/symple/include/icy/symple/client.h:107

Defaulted constructor.

{#clientdata}

ClientData

#include <src/symple/src/client/detail.h>
struct ClientData

Defined in src/symple/src/client/detail.h:13

List of all members

NameKindOwner
optionsvariableDeclared here
loopvariableDeclared here
wsvariableDeclared here
rostervariableDeclared here
ourIDvariableDeclared here
currentRoomsvariableDeclared here
desiredRoomsvariableDeclared here
pendingJoinsvariableDeclared here
pendingLeavesvariableDeclared here
announceStatusvariableDeclared here
reconnectTimervariableDeclared here
reconnectCountvariableDeclared here
wasOnlinevariableDeclared here
closingvariableDeclared here
remoteShutdownvariableDeclared here
ClientDatafunctionDeclared here

Public Attributes

ReturnNameDescription
Optionsoptions
uv::Loop *loop
http::ClientConnection::Ptrws
Rosterroster
std::stringourID
std::unordered_set< std::string >currentRoomsAuthoritative rooms from welcome / acks.
std::unordered_set< std::string >desiredRoomsRooms the client wants persisted across reconnects.
std::unordered_set< std::string >pendingJoinsJoin requests sent but not yet acknowledged.
std::unordered_set< std::string >pendingLeavesLeave requests sent but not yet acknowledged.
intannounceStatus
TimerreconnectTimer
intreconnectCount
boolwasOnline
boolclosing
boolremoteShutdown

{#options-15}

options

Options options

Defined in src/symple/src/client/detail.h:22


{#loop-8}

loop

uv::Loop * loop

Defined in src/symple/src/client/detail.h:23


{#ws-1}

ws

http::ClientConnection::Ptr ws

Defined in src/symple/src/client/detail.h:24


{#roster-1}

roster

Roster roster

Defined in src/symple/src/client/detail.h:25


{#ourid-1}

ourID

std::string ourID

Defined in src/symple/src/client/detail.h:26


{#currentrooms}

currentRooms

std::unordered_set< std::string > currentRooms

Defined in src/symple/src/client/detail.h:27

Authoritative rooms from welcome / acks.


{#desiredrooms}

desiredRooms

std::unordered_set< std::string > desiredRooms

Defined in src/symple/src/client/detail.h:28

Rooms the client wants persisted across reconnects.


{#pendingjoins}

pendingJoins

std::unordered_set< std::string > pendingJoins

Defined in src/symple/src/client/detail.h:29

Join requests sent but not yet acknowledged.


{#pendingleaves}

pendingLeaves

std::unordered_set< std::string > pendingLeaves

Defined in src/symple/src/client/detail.h:30

Leave requests sent but not yet acknowledged.


{#announcestatus}

announceStatus

int announceStatus = 0

Defined in src/symple/src/client/detail.h:31


{#reconnecttimer}

reconnectTimer

Timer reconnectTimer

Defined in src/symple/src/client/detail.h:32


{#reconnectcount}

reconnectCount

int reconnectCount = 0

Defined in src/symple/src/client/detail.h:33


{#wasonline}

wasOnline

bool wasOnline = false

Defined in src/symple/src/client/detail.h:34


{#closing-2}

closing

bool closing = false

Defined in src/symple/src/client/detail.h:35


{#remoteshutdown}

remoteShutdown

bool remoteShutdown = false

Defined in src/symple/src/client/detail.h:36

Public Methods

ReturnNameDescription
ClientData inline explicit

{#clientdata-1}

ClientData

inline explicit

inline explicit ClientData(Options opts, uv::Loop * targetLoop)

Defined in src/symple/src/client/detail.h:15

{#command}

Command

#include <icy/symple/command.h>
class Command

Defined in src/symple/include/icy/symple/command.h:28

Inherits: Message

Symple command message with a node path and action verb.

The [node](#node) field is a colon-delimited path (e.g. "camera:zoom:in"). Individual path segments can be retrieved with param().

List of all members

NameKindOwner
CommandfunctionDeclared here
CommandfunctionDeclared here
CommandfunctionDeclared here
nodefunctionDeclared here
actionfunctionDeclared here
setNodefunctionDeclared here
setActionfunctionDeclared here
validfunctionDeclared here
paramfunctionDeclared here
paramsfunctionDeclared here
matchesfunctionDeclared here
MessagefunctionInherited from Message
MessagefunctionInherited from Message
MessagefunctionInherited from Message
clonefunctionInherited from Message
validfunctionInherited from Message
clearfunctionInherited from Message
clearDatafunctionInherited from Message
clearNotesfunctionInherited from Message
typefunctionInherited from Message
idfunctionInherited from Message
tofunctionInherited from Message
fromfunctionInherited from Message
toUserfunctionInherited from Message
toIdfunctionInherited from Message
fromUserfunctionInherited from Message
fromIdfunctionInherited from Message
statusfunctionInherited from Message
setTypefunctionInherited from Message
setTofunctionInherited from Message
setTofunctionInherited from Message
setTofunctionInherited from Message
setFromfunctionInherited from Message
setFromfunctionInherited from Message
setFromfunctionInherited from Message
setStatusfunctionInherited from Message
notesfunctionInherited from Message
setNotefunctionInherited from Message
addNotefunctionInherited from Message
datafunctionInherited from Message
datafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
removeDatafunctionInherited from Message
hasDatafunctionInherited from Message
readfunctionInherited from Message
readfunctionInherited from Message
writefunctionInherited from Message
isRequestfunctionInherited from Message
sizefunctionInherited from Message
printfunctionInherited from Message
classNamefunctionInherited from Message
datafunctionInherited from Message
hasDatafunctionInherited from Message
opaquevariableInherited from IPacket
infovariableInherited from IPacket
flagsvariableInherited from IPacket
IPacketfunctionInherited from IPacket
IPacketfunctionInherited from IPacket
operator=functionInherited from IPacket
clonefunctionInherited from IPacket
~IPacketfunctionInherited from IPacket
readfunctionInherited from IPacket
writefunctionInherited from IPacket
sizefunctionInherited from IPacket
hasDatafunctionInherited from IPacket
datafunctionInherited from IPacket
constDatafunctionInherited from IPacket
classNamefunctionInherited from IPacket
printfunctionInherited from IPacket
operator<<friendInherited from IPacket

Inherited from Message

KindNameDescription
functionMessageConstructs a new message with a random ID and type set to "message".
functionMessageConstructs a message from a JSON value; sets missing id/type fields.
functionMessageCopy constructor; preserves or generates id/type fields.
functionclone virtual const overrideReturns a heap-allocated copy of this message.
functionvalid virtual constReturns true if the message has both [type](#type-22) and [id](#id-7) fields.
functionclear virtualClears all JSON fields from this message.
functionclearData virtualClears the [data](#data-4) sub-object.
functionclearNotes virtualClears the [notes](#notes) array.
functiontype const nodiscardReturns the message type string (defaults to "message").
functionid const nodiscardReturns the message ID string.
functionto const nodiscardReturns the recipient address parsed from the [to](#to) field.
functionfrom const nodiscardReturns the sender address parsed from the [from](#from) field.
functiontoUser const nodiscardReturns the user component of the [to](#to) address without constructing an Address.
functiontoId const nodiscardReturns the id component of the [to](#to) address without constructing an Address.
functionfromUser const nodiscardReturns the user component of the [from](#from) address without constructing an Address.
functionfromId const nodiscardReturns the id component of the [from](#from) address without constructing an Address.
functionstatus const nodiscardReturns the HTTP status code, or -1 if not set.
functionsetTypeSets the message type field.
functionsetToSets the [to](#to) field from a peer's address.
functionsetToSets the [to](#to) field from an address object.
functionsetToSets the [to](#to) field from an address string.
functionsetFromSets the [from](#from) field from a peer's address.
functionsetFromSets the [from](#from) field from an address object.
functionsetFromSets the [from](#from) field from an address string.
functionsetStatusHTTP status codes are used to describe the message response. Throws std::invalid_argument if code is outside [101, 504].
functionnotesReturns a reference to the [notes](#notes) JSON array.
functionsetNoteReplaces all notes with a single note.
functionaddNoteAppends a note to the [notes](#notes) array.
functiondata constReturns a copy of the named data field.
functiondataReturns a reference to the named data field (creates it if absent).
functionsetDataCreates or replaces a named data field; returns a reference to it.
functionsetDataSets a named data field to a C-string value.
functionsetDataSets a named data field to a string value.
functionsetDataSets a named data field to a JSON value.
functionsetDataSets a named data field to an integer value.
functionremoveDataRemoves a named field from the [data](#data-4) sub-object.
functionhasDataReturns true if the named field exists in the [data](#data-4) sub-object.
functionread virtual overrideDeserialises the message from a raw buffer.
functionread virtualDeserialises the message from a JSON string.
functionwrite virtual const overrideSerialises the message as JSON into a buffer.
functionisRequest const nodiscardReturns true if no status code has been set (i.e. status() == -1).
functionsize virtual const overrideReturns the serialised JSON size in bytes.
functionprint virtual const overridePretty-prints the message JSON to the given stream.
functionclassName virtual const inline overrideReturns the class name of this packet type for logging and diagnostics.
functiondata virtual const inlineThe packet data pointer for buffered packets.
functionhasData virtual const inlineReturns true if the packet has a non-null data pointer.

Inherited from IPacket

KindNameDescription
variableopaqueOptional type-safe context data. Use std::any_cast to retrieve. Lifetime of the stored value is tied to the packet's lifetime.
variableinfoOptional extra information about the packet.
variableflagsProvides basic information about the packet.
functionIPacket inline
functionIPacket inlineCopy constructor; clones the info object if present.
functionoperator= inlineCopy assignment; clones the info object if present.
functionclone virtual constReturns a heap-allocated deep copy of this packet.
function~IPacket virtualDefaulted destructor.
functionread virtualRead/parse to the packet from the given input buffer. The number of bytes read is returned.
functionwrite virtual constCopy/generate to the packet given output buffer. The number of bytes written can be obtained from the buffer.
functionsize virtual const inlineThe size of the packet in bytes.
functionhasData virtual const inlineReturns true if the packet has a non-null data pointer.
functiondata virtual const inlineThe packet data pointer for buffered packets.
functionconstData virtual const inlineThe const packet data pointer for buffered packets.
functionclassName virtual constReturns the class name of this packet type for logging and diagnostics.
functionprint virtual const inlinePrints a human-readable representation to the given stream.
friendoperator<< inlineStream insertion operator; delegates to print().

Public Methods

ReturnNameDescription
CommandConstructs an empty command with type set to "command".
CommandConstructs a command from a JSON value.
CommandCopy constructor.
std::stringnode const nodiscardReturns the colon-delimited node path (e.g. "camera:zoom").
std::stringaction const nodiscardReturns the action verb (defaults to "execute").
voidsetNodeSets the node path field.
voidsetActionSets the action verb field.
boolvalid virtual constReturns true if the base message is valid and the [node](#node) field is set.
std::stringparam const nodiscardReturns the nth colon-separated segment of the node path (1-based). Throws std::out_of_range if n exceeds the number of segments.
std::vector< std::string >paramsReturns all colon-separated segments of the node path.
boolmatches const nodiscardReturns true if the node path matches the given pattern. Uses wildcard node matching via util::matchNodes.

{#command-1}

Command

Command()

Defined in src/symple/include/icy/symple/command.h:32

Constructs an empty command with type set to "command".


{#command-2}

Command

Command(const json::Value & root)

Defined in src/symple/include/icy/symple/command.h:36

Constructs a command from a JSON value.

Parameters

  • root JSON object to initialise from.

{#command-3}

Command

Command(const Command & root)

Defined in src/symple/include/icy/symple/command.h:40

Copy constructor.

Parameters

  • root Source command.

{#node}

node

const nodiscard

[[nodiscard]] std::string node() const

Defined in src/symple/include/icy/symple/command.h:45

Returns the colon-delimited node path (e.g. "camera:zoom").


{#action-2}

action

const nodiscard

[[nodiscard]] std::string action() const

Defined in src/symple/include/icy/symple/command.h:48

Returns the action verb (defaults to "execute").


{#setnode}

setNode

void setNode(std::string_view node)

Defined in src/symple/include/icy/symple/command.h:52

Sets the node path field.

Parameters

  • node Colon-delimited node path string.

{#setaction}

setAction

void setAction(std::string_view action)

Defined in src/symple/include/icy/symple/command.h:56

Sets the action verb field.

Parameters

  • action Action string (e.g. "execute", "get", "set").

{#valid-11}

valid

virtual const

virtual bool valid() const

Defined in src/symple/include/icy/symple/command.h:59

Returns true if the base message is valid and the [node](#node) field is set.

Reimplements

{#param}

param

const nodiscard

[[nodiscard]] std::string param(int n) const

Defined in src/symple/include/icy/symple/command.h:65

Returns the nth colon-separated segment of the node path (1-based). Throws std::out_of_range if n exceeds the number of segments.

Parameters

  • n 1-based segment index.

Returns

The nth path segment.


{#params}

params

std::vector< std::string > params()

Defined in src/symple/include/icy/symple/command.h:69

Returns all colon-separated segments of the node path.

Returns

Vector of path segment strings.


{#matches-3}

matches

const nodiscard

[[nodiscard]] bool matches(std::string_view xnode) const

Defined in src/symple/include/icy/symple/command.h:74

Returns true if the node path matches the given pattern. Uses wildcard node matching via util::matchNodes.

Parameters

  • xnode Pattern to match against (colon-delimited, supports wildcards).

{#event-2}

Event

#include <icy/symple/event.h>
class Event

Defined in src/symple/include/icy/symple/event.h:29

Inherits: Message

Symple event message carrying a named occurrence with a timestamp.

The [name](#name-13) field identifies the event. The [time](base.md#time-3) field is stored as a Unix timestamp (seconds since epoch).

List of all members

NameKindOwner
EventfunctionDeclared here
EventfunctionDeclared here
EventfunctionDeclared here
validfunctionDeclared here
namefunctionDeclared here
timefunctionDeclared here
setNamefunctionDeclared here
setTimefunctionDeclared here
MessagefunctionInherited from Message
MessagefunctionInherited from Message
MessagefunctionInherited from Message
clonefunctionInherited from Message
validfunctionInherited from Message
clearfunctionInherited from Message
clearDatafunctionInherited from Message
clearNotesfunctionInherited from Message
typefunctionInherited from Message
idfunctionInherited from Message
tofunctionInherited from Message
fromfunctionInherited from Message
toUserfunctionInherited from Message
toIdfunctionInherited from Message
fromUserfunctionInherited from Message
fromIdfunctionInherited from Message
statusfunctionInherited from Message
setTypefunctionInherited from Message
setTofunctionInherited from Message
setTofunctionInherited from Message
setTofunctionInherited from Message
setFromfunctionInherited from Message
setFromfunctionInherited from Message
setFromfunctionInherited from Message
setStatusfunctionInherited from Message
notesfunctionInherited from Message
setNotefunctionInherited from Message
addNotefunctionInherited from Message
datafunctionInherited from Message
datafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
removeDatafunctionInherited from Message
hasDatafunctionInherited from Message
readfunctionInherited from Message
readfunctionInherited from Message
writefunctionInherited from Message
isRequestfunctionInherited from Message
sizefunctionInherited from Message
printfunctionInherited from Message
classNamefunctionInherited from Message
datafunctionInherited from Message
hasDatafunctionInherited from Message
opaquevariableInherited from IPacket
infovariableInherited from IPacket
flagsvariableInherited from IPacket
IPacketfunctionInherited from IPacket
IPacketfunctionInherited from IPacket
operator=functionInherited from IPacket
clonefunctionInherited from IPacket
~IPacketfunctionInherited from IPacket
readfunctionInherited from IPacket
writefunctionInherited from IPacket
sizefunctionInherited from IPacket
hasDatafunctionInherited from IPacket
datafunctionInherited from IPacket
constDatafunctionInherited from IPacket
classNamefunctionInherited from IPacket
printfunctionInherited from IPacket
operator<<friendInherited from IPacket

Inherited from Message

KindNameDescription
functionMessageConstructs a new message with a random ID and type set to "message".
functionMessageConstructs a message from a JSON value; sets missing id/type fields.
functionMessageCopy constructor; preserves or generates id/type fields.
functionclone virtual const overrideReturns a heap-allocated copy of this message.
functionvalid virtual constReturns true if the message has both [type](#type-22) and [id](#id-7) fields.
functionclear virtualClears all JSON fields from this message.
functionclearData virtualClears the [data](#data-4) sub-object.
functionclearNotes virtualClears the [notes](#notes) array.
functiontype const nodiscardReturns the message type string (defaults to "message").
functionid const nodiscardReturns the message ID string.
functionto const nodiscardReturns the recipient address parsed from the [to](#to) field.
functionfrom const nodiscardReturns the sender address parsed from the [from](#from) field.
functiontoUser const nodiscardReturns the user component of the [to](#to) address without constructing an Address.
functiontoId const nodiscardReturns the id component of the [to](#to) address without constructing an Address.
functionfromUser const nodiscardReturns the user component of the [from](#from) address without constructing an Address.
functionfromId const nodiscardReturns the id component of the [from](#from) address without constructing an Address.
functionstatus const nodiscardReturns the HTTP status code, or -1 if not set.
functionsetTypeSets the message type field.
functionsetToSets the [to](#to) field from a peer's address.
functionsetToSets the [to](#to) field from an address object.
functionsetToSets the [to](#to) field from an address string.
functionsetFromSets the [from](#from) field from a peer's address.
functionsetFromSets the [from](#from) field from an address object.
functionsetFromSets the [from](#from) field from an address string.
functionsetStatusHTTP status codes are used to describe the message response. Throws std::invalid_argument if code is outside [101, 504].
functionnotesReturns a reference to the [notes](#notes) JSON array.
functionsetNoteReplaces all notes with a single note.
functionaddNoteAppends a note to the [notes](#notes) array.
functiondata constReturns a copy of the named data field.
functiondataReturns a reference to the named data field (creates it if absent).
functionsetDataCreates or replaces a named data field; returns a reference to it.
functionsetDataSets a named data field to a C-string value.
functionsetDataSets a named data field to a string value.
functionsetDataSets a named data field to a JSON value.
functionsetDataSets a named data field to an integer value.
functionremoveDataRemoves a named field from the [data](#data-4) sub-object.
functionhasDataReturns true if the named field exists in the [data](#data-4) sub-object.
functionread virtual overrideDeserialises the message from a raw buffer.
functionread virtualDeserialises the message from a JSON string.
functionwrite virtual const overrideSerialises the message as JSON into a buffer.
functionisRequest const nodiscardReturns true if no status code has been set (i.e. status() == -1).
functionsize virtual const overrideReturns the serialised JSON size in bytes.
functionprint virtual const overridePretty-prints the message JSON to the given stream.
functionclassName virtual const inline overrideReturns the class name of this packet type for logging and diagnostics.
functiondata virtual const inlineThe packet data pointer for buffered packets.
functionhasData virtual const inlineReturns true if the packet has a non-null data pointer.

Inherited from IPacket

KindNameDescription
variableopaqueOptional type-safe context data. Use std::any_cast to retrieve. Lifetime of the stored value is tied to the packet's lifetime.
variableinfoOptional extra information about the packet.
variableflagsProvides basic information about the packet.
functionIPacket inline
functionIPacket inlineCopy constructor; clones the info object if present.
functionoperator= inlineCopy assignment; clones the info object if present.
functionclone virtual constReturns a heap-allocated deep copy of this packet.
function~IPacket virtualDefaulted destructor.
functionread virtualRead/parse to the packet from the given input buffer. The number of bytes read is returned.
functionwrite virtual constCopy/generate to the packet given output buffer. The number of bytes written can be obtained from the buffer.
functionsize virtual const inlineThe size of the packet in bytes.
functionhasData virtual const inlineReturns true if the packet has a non-null data pointer.
functiondata virtual const inlineThe packet data pointer for buffered packets.
functionconstData virtual const inlineThe const packet data pointer for buffered packets.
functionclassName virtual constReturns the class name of this packet type for logging and diagnostics.
functionprint virtual const inlinePrints a human-readable representation to the given stream.
friendoperator<< inlineStream insertion operator; delegates to print().

Public Methods

ReturnNameDescription
EventConstructs an event with type "event" and time set to now.
EventConstructs an event from a JSON value; sets missing time to now.
EventCopy constructor; preserves or sets missing time to now.
boolvalid virtual const nodiscardReturns true if the base message is valid and the [name](#name-13) field is set.
std::stringname const nodiscardReturns the event name string.
std::time_ttime const nodiscardReturns the event timestamp as a Unix time_t value.
voidsetNameSets the event name field.
voidsetTimeSets the event timestamp.

{#event-3}

Event

Event()

Defined in src/symple/include/icy/symple/event.h:33

Constructs an event with type "event" and time set to now.


{#event-4}

Event

Event(const json::Value & root)

Defined in src/symple/include/icy/symple/event.h:37

Constructs an event from a JSON value; sets missing time to now.

Parameters

  • root JSON object to initialise from.

{#event-5}

Event

Event(const Event & root)

Defined in src/symple/include/icy/symple/event.h:41

Copy constructor; preserves or sets missing time to now.

Parameters

  • root Source event.

{#valid-12}

valid

virtual const nodiscard

[[nodiscard]] virtual bool valid() const

Defined in src/symple/include/icy/symple/event.h:46

Returns true if the base message is valid and the [name](#name-13) field is set.

Reimplements

{#name-13}

name

const nodiscard

[[nodiscard]] std::string name() const

Defined in src/symple/include/icy/symple/event.h:49

Returns the event name string.


{#time-4}

time

const nodiscard

[[nodiscard]] std::time_t time() const

Defined in src/symple/include/icy/symple/event.h:53

Returns the event timestamp as a Unix time_t value.


{#setname-2}

setName

void setName(std::string_view name)

Defined in src/symple/include/icy/symple/event.h:57

Sets the event name field.

Parameters

  • name Event name string.

{#settime}

setTime

void setTime(std::time_t time)

Defined in src/symple/include/icy/symple/event.h:62

Sets the event timestamp.

Parameters

  • time Unix timestamp (seconds since epoch).

{#form}

Form

#include <icy/symple/form.h>
class Form

Defined in src/symple/include/icy/symple/form.h:178

Inherits: FormElement

Interactive form with pages, sections, and fields for command data exchange.

Attach a Form to a Command message to carry structured input/output. The [action](#action-3) field governs the exchange direction; [partial](#partial) enables live/auto-complete field submission.

List of all members

NameKindOwner
FormfunctionDeclared here
FormfunctionDeclared here
FormfunctionDeclared here
validfunctionDeclared here
actionfunctionDeclared here
partialfunctionDeclared here
setActionfunctionDeclared here
setPartialfunctionDeclared here
FormElementfunctionInherited from FormElement
FormElementfunctionInherited from FormElement
FormElementfunctionInherited from FormElement
operator=functionInherited from FormElement
typefunctionInherited from FormElement
idfunctionInherited from FormElement
labelfunctionInherited from FormElement
setTypefunctionInherited from FormElement
setIdfunctionInherited from FormElement
setLabelfunctionInherited from FormElement
setHintfunctionInherited from FormElement
setErrorfunctionInherited from FormElement
addPagefunctionInherited from FormElement
addSectionfunctionInherited from FormElement
addFieldfunctionInherited from FormElement
getFieldfunctionInherited from FormElement
getFieldfunctionInherited from FormElement
hasFieldfunctionInherited from FormElement
setLivefunctionInherited from FormElement
livefunctionInherited from FormElement
clearElementsfunctionInherited from FormElement
clearfunctionInherited from FormElement
validfunctionInherited from FormElement
numElementsfunctionInherited from FormElement
hasErrorsfunctionInherited from FormElement
hasPagesfunctionInherited from FormElement
rootfunctionInherited from FormElement
_rootvariableInherited from FormElement

Inherited from FormElement

KindNameDescription
functionFormElementConstructs an unbound element (root pointer is null).
functionFormElementConstructs an element bound to the given JSON node.
functionFormElementCopy constructor; copies the root pointer reference (shallow).
functionoperator=Copy-assigns the root pointer reference.
functiontype const nodiscardReturns the element type string.
functionid const nodiscardReturns the element ID string.
functionlabel const nodiscardReturns the display label string.
functionsetTypeSets the element type. Possible values: page, section, text, text-multi, list, list-multi, checkbox, media, custom
functionsetIdSets the element ID field.
functionsetLabelSets the display label field.
functionsetHintSets the hint/description field shown below the element.
functionsetErrorSets an optional validation error message.
functionaddPageAppends a page child element and returns a handle to it.
functionaddSectionAppends a section child element and returns a handle to it.
functionaddFieldAppends a typed field child element and returns a handle to it. Throws std::invalid_argument if type is not a recognised field type.
functiongetFieldSearches child elements for the field with the given ID.
functiongetFieldPopulates a FormField by searching child elements for the given ID.
functionhasFieldReturns true if any child element has an ID matching the given value.
functionsetLiveSets the live flag on this element. Live elements are used to submit partial form sections (e.g. for auto-complete) without sending the entire form.
functionlive const nodiscardReturns true if this field is live, meaning the form-processing entity should auto-update this field's value whenever it changes.
functionclearElementsRemoves all child elements whose ID matches the given value.
functionclearClears all fields from the underlying JSON node.
functionvalid const nodiscardReturns true if the form element is valid.
functionnumElementsReturns the number of child elements.
functionhasErrorsReturns true if any fields have errors.
functionhasPagesReturns true if the form has multiple pages.
functionroot const nodiscardReturns a reference to the underlying JSON node. Throws std::runtime_error if the root pointer is null.
variable_rootThe root pointer is just a reference to the externally managed JSON value memory.

Public Methods

ReturnNameDescription
FormConstructs an unbound form (root pointer is null).
FormConstructs a form bound to the given JSON node. Sets the [type](#type-21) field to "form".
FormConstructs a form from a Command, binding to command["form"]. Sets the [type](#type-21) field to "form".
boolvalidReturns true if the element is valid, non-empty, and has no errors.
std::stringaction const nodiscardReturns the form action string (defaults to "form").
boolpartial const nodiscardReturns true if this is a partial form submission.
voidsetActionSets the form action field. Throws std::invalid_argument for unrecognised values. Possible values: form - Form-processing entity requests form completion. submit - Form-submitting entity is sending data. cancel - Form-submitting entity cancelled submission. result - Form-processing entity is returning data.
voidsetPartialMarks the form as a partial section for live/auto-complete updates. Partial forms transmit only the changed fields rather than the entire form payload.

{#form-1}

Form

Form()

Defined in src/symple/include/icy/symple/form.h:182

Constructs an unbound form (root pointer is null).


{#form-2}

Form

Form(json::Value & root)

Defined in src/symple/include/icy/symple/form.h:187

Constructs a form bound to the given JSON node. Sets the [type](#type-21) field to "form".

Parameters

  • root JSON node to bind to.

{#form-3}

Form

Form(Command & root)

Defined in src/symple/include/icy/symple/form.h:192

Constructs a form from a Command, binding to command["form"]. Sets the [type](#type-21) field to "form".

Parameters

  • root Parent command message.

{#valid-13}

valid

bool valid()

Defined in src/symple/include/icy/symple/form.h:197

Returns true if the element is valid, non-empty, and has no errors.


{#action-3}

action

const nodiscard

[[nodiscard]] std::string action() const

Defined in src/symple/include/icy/symple/form.h:200

Returns the form action string (defaults to "form").


{#partial}

partial

const nodiscard

[[nodiscard]] bool partial() const

Defined in src/symple/include/icy/symple/form.h:203

Returns true if this is a partial form submission.


{#setaction-1}

setAction

void setAction(std::string_view action)

Defined in src/symple/include/icy/symple/form.h:213

Sets the form action field. Throws std::invalid_argument for unrecognised values. Possible values: form - Form-processing entity requests form completion. submit - Form-submitting entity is sending data. cancel - Form-submitting entity cancelled submission. result - Form-processing entity is returning data.

Parameters

  • action Action string.

{#setpartial}

setPartial

void setPartial(bool flag)

Defined in src/symple/include/icy/symple/form.h:219

Marks the form as a partial section for live/auto-complete updates. Partial forms transmit only the changed fields rather than the entire form payload.

Parameters

  • flag True to mark as partial.

{#formelement}

FormElement

#include <icy/symple/form.h>
class FormElement

Defined in src/symple/include/icy/symple/form.h:33

Subclassed by: Form, FormField

Base element within a Symple form.

FormElement wraps a reference to an external JSON node and provides typed accessors for the common [type](#type-21), [id](#id-6), [label](#label), and elements fields. Pages, sections, and fields all derive from this base.

List of all members

NameKindOwner
FormElementfunctionDeclared here
FormElementfunctionDeclared here
FormElementfunctionDeclared here
operator=functionDeclared here
typefunctionDeclared here
idfunctionDeclared here
labelfunctionDeclared here
setTypefunctionDeclared here
setIdfunctionDeclared here
setLabelfunctionDeclared here
setHintfunctionDeclared here
setErrorfunctionDeclared here
addPagefunctionDeclared here
addSectionfunctionDeclared here
addFieldfunctionDeclared here
getFieldfunctionDeclared here
getFieldfunctionDeclared here
hasFieldfunctionDeclared here
setLivefunctionDeclared here
livefunctionDeclared here
clearElementsfunctionDeclared here
clearfunctionDeclared here
validfunctionDeclared here
numElementsfunctionDeclared here
hasErrorsfunctionDeclared here
hasPagesfunctionDeclared here
rootfunctionDeclared here
_rootvariableDeclared here

Public Methods

ReturnNameDescription
FormElementConstructs an unbound element (root pointer is null).
FormElementConstructs an element bound to the given JSON node.
FormElementCopy constructor; copies the root pointer reference (shallow).
FormElement &operator=Copy-assigns the root pointer reference.
std::stringtype const nodiscardReturns the element type string.
std::stringid const nodiscardReturns the element ID string.
std::stringlabel const nodiscardReturns the display label string.
voidsetTypeSets the element type. Possible values: page, section, text, text-multi, list, list-multi, checkbox, media, custom
voidsetIdSets the element ID field.
voidsetLabelSets the display label field.
voidsetHintSets the hint/description field shown below the element.
voidsetErrorSets an optional validation error message.
FormElementaddPageAppends a page child element and returns a handle to it.
FormElementaddSectionAppends a section child element and returns a handle to it.
FormFieldaddFieldAppends a typed field child element and returns a handle to it. Throws std::invalid_argument if type is not a recognised field type.
FormFieldgetFieldSearches child elements for the field with the given ID.
boolgetFieldPopulates a FormField by searching child elements for the given ID.
boolhasFieldReturns true if any child element has an ID matching the given value.
voidsetLiveSets the live flag on this element. Live elements are used to submit partial form sections (e.g. for auto-complete) without sending the entire form.
boollive const nodiscardReturns true if this field is live, meaning the form-processing entity should auto-update this field's value whenever it changes.
boolclearElementsRemoves all child elements whose ID matches the given value.
voidclearClears all fields from the underlying JSON node.
boolvalid const nodiscardReturns true if the form element is valid.
intnumElementsReturns the number of child elements.
boolhasErrorsReturns true if any fields have errors.
boolhasPagesReturns true if the form has multiple pages.
json::Value &root const nodiscardReturns a reference to the underlying JSON node. Throws std::runtime_error if the root pointer is null.

{#formelement-1}

FormElement

FormElement()

Defined in src/symple/include/icy/symple/form.h:37

Constructs an unbound element (root pointer is null).


{#formelement-2}

FormElement

FormElement(json::Value & root, std::string_view type = "", std::string_view id = "", std::string_view label = "")

Defined in src/symple/include/icy/symple/form.h:44

Constructs an element bound to the given JSON node.

Parameters

  • root JSON node this element refers to.

  • type Optional element type string.

  • id Optional element ID string.

  • label Optional display label string.


{#formelement-3}

FormElement

FormElement(const FormElement & r)

Defined in src/symple/include/icy/symple/form.h:49

Copy constructor; copies the root pointer reference (shallow).

Parameters

  • r Source element.

{#operator-37}

operator=

FormElement & operator=(const FormElement & r)

Defined in src/symple/include/icy/symple/form.h:53

Copy-assigns the root pointer reference.

Parameters

  • r Source element.

{#type-21}

type

const nodiscard

[[nodiscard]] std::string type() const

Defined in src/symple/include/icy/symple/form.h:58

Returns the element type string.


{#id-6}

id

const nodiscard

[[nodiscard]] std::string id() const

Defined in src/symple/include/icy/symple/form.h:61

Returns the element ID string.


{#label}

label

const nodiscard

[[nodiscard]] std::string label() const

Defined in src/symple/include/icy/symple/form.h:64

Returns the display label string.


{#settype-1}

setType

void setType(std::string_view type)

Defined in src/symple/include/icy/symple/form.h:70

Sets the element type. Possible values: page, section, text, text-multi, list, list-multi, checkbox, media, custom

Parameters

  • type Element type string.

{#setid}

setId

void setId(std::string_view id)

Defined in src/symple/include/icy/symple/form.h:74

Sets the element ID field.

Parameters

  • id Element ID string.

{#setlabel}

setLabel

void setLabel(std::string_view text)

Defined in src/symple/include/icy/symple/form.h:78

Sets the display label field.

Parameters

  • text Label text.

{#sethint}

setHint

void setHint(std::string_view text)

Defined in src/symple/include/icy/symple/form.h:82

Sets the hint/description field shown below the element.

Parameters

  • text Hint text.

{#seterror-7}

setError

void setError(std::string_view error)

Defined in src/symple/include/icy/symple/form.h:86

Sets an optional validation error message.

Parameters

  • error Error text to display.

{#addpage}

addPage

FormElement addPage(std::string_view id = "", std::string_view label = "")

Defined in src/symple/include/icy/symple/form.h:92

Appends a page child element and returns a handle to it.

Parameters

  • id Optional page ID.

  • label Optional page label.

Returns

FormElement referencing the new page node.


{#addsection}

addSection

FormElement addSection(std::string_view id = "", std::string_view label = "")

Defined in src/symple/include/icy/symple/form.h:99

Appends a section child element and returns a handle to it.

Parameters

  • id Optional section ID.

  • label Optional section label.

Returns

FormElement referencing the new section node.


{#addfield}

addField

FormField addField(std::string_view type, std::string_view id = "", std::string_view label = "")

Defined in src/symple/include/icy/symple/form.h:108

Appends a typed field child element and returns a handle to it. Throws std::invalid_argument if type is not a recognised field type.

Parameters

  • type Field type (e.g. "text", "list", "boolean").

  • id Optional field ID.

  • label Optional field label.

Returns

FormField referencing the new field node.


{#getfield}

getField

FormField getField(std::string_view id, bool partial = false)

Defined in src/symple/include/icy/symple/form.h:115

Searches child elements for the field with the given ID.

Parameters

  • id Field ID to search for.

  • partial If true, performs a substring match.

Returns

FormField handle (may be invalid if not found).


{#getfield-1}

getField

bool getField(std::string_view id, FormField & field, bool partial = false)

Defined in src/symple/include/icy/symple/form.h:122

Populates a FormField by searching child elements for the given ID.

Parameters

  • id Field ID to search for.

  • field Output field handle.

  • partial If true, performs a substring match.

Returns

True if the field was found.


{#hasfield}

hasField

bool hasField(std::string_view id, bool partial = false)

Defined in src/symple/include/icy/symple/form.h:128

Returns true if any child element has an ID matching the given value.

Parameters

  • id ID string to search for.

  • partial If true, a substring match is sufficient.


{#setlive}

setLive

void setLive(bool flag)

Defined in src/symple/include/icy/symple/form.h:134

Sets the live flag on this element. Live elements are used to submit partial form sections (e.g. for auto-complete) without sending the entire form.

Parameters

  • flag True to enable live updates.

{#live}

live

const nodiscard

[[nodiscard]] bool live() const

Defined in src/symple/include/icy/symple/form.h:139

Returns true if this field is live, meaning the form-processing entity should auto-update this field's value whenever it changes.


{#clearelements}

clearElements

bool clearElements(std::string_view id, bool partial = false)

Defined in src/symple/include/icy/symple/form.h:145

Removes all child elements whose ID matches the given value.

Parameters

  • id ID string to match against.

  • partial If true, removes elements whose ID contains the string.

Returns

True if at least one element was removed.


{#clear-3}

clear

void clear()

Defined in src/symple/include/icy/symple/form.h:148

Clears all fields from the underlying JSON node.


{#valid-14}

valid

const nodiscard

[[nodiscard]] bool valid() const

Defined in src/symple/include/icy/symple/form.h:151

Returns true if the form element is valid.


{#numelements}

numElements

int numElements()

Defined in src/symple/include/icy/symple/form.h:154

Returns the number of child elements.


{#haserrors}

hasErrors

bool hasErrors()

Defined in src/symple/include/icy/symple/form.h:157

Returns true if any fields have errors.


{#haspages}

hasPages

bool hasPages()

Defined in src/symple/include/icy/symple/form.h:160

Returns true if the form has multiple pages.


{#root-4}

root

const nodiscard

[[nodiscard]] json::Value & root() const

Defined in src/symple/include/icy/symple/form.h:164

Returns a reference to the underlying JSON node. Throws std::runtime_error if the root pointer is null.

Protected Attributes

ReturnNameDescription
json::Value *_rootThe root pointer is just a reference to the externally managed JSON value memory.

{#_root}

_root

json::Value * _root

Defined in src/symple/include/icy/symple/form.h:169

The root pointer is just a reference to the externally managed JSON value memory.

{#formfield}

FormField

#include <icy/symple/form.h>
class FormField

Defined in src/symple/include/icy/symple/form.h:227

Inherits: FormElement

Form input field with typed values and selectable options.

Values are stored as strings in a JSON array. Typed accessors (intValue, doubleValue, boolValue) parse the first string on demand.

List of all members

NameKindOwner
FormFieldfunctionDeclared here
FormFieldfunctionDeclared here
addOptionfunctionDeclared here
addOptionfunctionDeclared here
setValuefunctionDeclared here
setValuefunctionDeclared here
setValuefunctionDeclared here
setValuefunctionDeclared here
addValuefunctionDeclared here
addValuefunctionDeclared here
addValuefunctionDeclared here
addValuefunctionDeclared here
valuesfunctionDeclared here
valuefunctionDeclared here
intValuefunctionDeclared here
doubleValuefunctionDeclared here
boolValuefunctionDeclared here
FormElementfunctionInherited from FormElement
FormElementfunctionInherited from FormElement
FormElementfunctionInherited from FormElement
operator=functionInherited from FormElement
typefunctionInherited from FormElement
idfunctionInherited from FormElement
labelfunctionInherited from FormElement
setTypefunctionInherited from FormElement
setIdfunctionInherited from FormElement
setLabelfunctionInherited from FormElement
setHintfunctionInherited from FormElement
setErrorfunctionInherited from FormElement
addPagefunctionInherited from FormElement
addSectionfunctionInherited from FormElement
addFieldfunctionInherited from FormElement
getFieldfunctionInherited from FormElement
getFieldfunctionInherited from FormElement
hasFieldfunctionInherited from FormElement
setLivefunctionInherited from FormElement
livefunctionInherited from FormElement
clearElementsfunctionInherited from FormElement
clearfunctionInherited from FormElement
validfunctionInherited from FormElement
numElementsfunctionInherited from FormElement
hasErrorsfunctionInherited from FormElement
hasPagesfunctionInherited from FormElement
rootfunctionInherited from FormElement
_rootvariableInherited from FormElement

Inherited from FormElement

KindNameDescription
functionFormElementConstructs an unbound element (root pointer is null).
functionFormElementConstructs an element bound to the given JSON node.
functionFormElementCopy constructor; copies the root pointer reference (shallow).
functionoperator=Copy-assigns the root pointer reference.
functiontype const nodiscardReturns the element type string.
functionid const nodiscardReturns the element ID string.
functionlabel const nodiscardReturns the display label string.
functionsetTypeSets the element type. Possible values: page, section, text, text-multi, list, list-multi, checkbox, media, custom
functionsetIdSets the element ID field.
functionsetLabelSets the display label field.
functionsetHintSets the hint/description field shown below the element.
functionsetErrorSets an optional validation error message.
functionaddPageAppends a page child element and returns a handle to it.
functionaddSectionAppends a section child element and returns a handle to it.
functionaddFieldAppends a typed field child element and returns a handle to it. Throws std::invalid_argument if type is not a recognised field type.
functiongetFieldSearches child elements for the field with the given ID.
functiongetFieldPopulates a FormField by searching child elements for the given ID.
functionhasFieldReturns true if any child element has an ID matching the given value.
functionsetLiveSets the live flag on this element. Live elements are used to submit partial form sections (e.g. for auto-complete) without sending the entire form.
functionlive const nodiscardReturns true if this field is live, meaning the form-processing entity should auto-update this field's value whenever it changes.
functionclearElementsRemoves all child elements whose ID matches the given value.
functionclearClears all fields from the underlying JSON node.
functionvalid const nodiscardReturns true if the form element is valid.
functionnumElementsReturns the number of child elements.
functionhasErrorsReturns true if any fields have errors.
functionhasPagesReturns true if the form has multiple pages.
functionroot const nodiscardReturns a reference to the underlying JSON node. Throws std::runtime_error if the root pointer is null.
variable_rootThe root pointer is just a reference to the externally managed JSON value memory.

Public Methods

ReturnNameDescription
FormFieldConstructs an unbound field (root pointer is null).
FormFieldConstructs a field bound to the given JSON node.
voidaddOptionAdds a labelled option for list-based fields.
voidaddOptionAdds an option whose key and display value are identical.
voidsetValueReplaces all current values with a single string value.
voidsetValueReplaces all current values with a single integer value.
voidsetValueReplaces all current values with a single double value.
voidsetValueReplaces all current values with a single boolean value.
voidaddValueAppends a string value to the values array.
voidaddValueAppends an integer value to the values array.
voidaddValueAppends a double value to the values array.
voidaddValueAppends a boolean value to the values array.
json::Value &valuesReturns a reference to the JSON array of all values.
std::stringvalue const nodiscardReturns the first value as a string. Most field types (except multi-value) only use a single value.
intintValue const nodiscardReturns the first value parsed as an integer.
doubledoubleValue const nodiscardReturns the first value parsed as a double.
boolboolValue const nodiscardReturns the first value parsed as a boolean. Treats "1", "true", and "on" as true; all other strings as false.

{#formfield-1}

FormField

FormField()

Defined in src/symple/include/icy/symple/form.h:231

Constructs an unbound field (root pointer is null).


{#formfield-2}

FormField

FormField(json::Value & root, std::string_view type = "", std::string_view id = "", std::string_view label = "")

Defined in src/symple/include/icy/symple/form.h:238

Constructs a field bound to the given JSON node.

Parameters

  • root JSON node to bind to.

  • type Field type string (e.g. "text", "list").

  • id Optional field ID.

  • label Optional display label.


{#addoption}

addOption

void addOption(std::string_view key, std::string_view value)

Defined in src/symple/include/icy/symple/form.h:245

Adds a labelled option for list-based fields.

Parameters

  • key Option key sent on submit.

  • value Display label for the option.


{#addoption-1}

addOption

void addOption(std::string_view value)

Defined in src/symple/include/icy/symple/form.h:249

Adds an option whose key and display value are identical.

Parameters

  • value Option string.

{#setvalue-4}

setValue

void setValue(std::string_view value)

Defined in src/symple/include/icy/symple/form.h:253

Replaces all current values with a single string value.

Parameters

  • value String value to set.

{#setvalue-5}

setValue

void setValue(int value)

Defined in src/symple/include/icy/symple/form.h:257

Replaces all current values with a single integer value.

Parameters

  • value Integer value to set.

{#setvalue-6}

setValue

void setValue(double value)

Defined in src/symple/include/icy/symple/form.h:261

Replaces all current values with a single double value.

Parameters

  • value Double value to set.

{#setvalue-7}

setValue

void setValue(bool value)

Defined in src/symple/include/icy/symple/form.h:265

Replaces all current values with a single boolean value.

Parameters

  • value Boolean value to set.

{#addvalue}

addValue

void addValue(std::string_view value)

Defined in src/symple/include/icy/symple/form.h:269

Appends a string value to the values array.

Parameters

  • value String value to append.

{#addvalue-1}

addValue

void addValue(int value)

Defined in src/symple/include/icy/symple/form.h:273

Appends an integer value to the values array.

Parameters

  • value Integer value to append.

{#addvalue-2}

addValue

void addValue(double value)

Defined in src/symple/include/icy/symple/form.h:277

Appends a double value to the values array.

Parameters

  • value Double value to append.

{#addvalue-3}

addValue

void addValue(bool value)

Defined in src/symple/include/icy/symple/form.h:281

Appends a boolean value to the values array.

Parameters

  • value Boolean value to append.

{#values}

values

json::Value & values()

Defined in src/symple/include/icy/symple/form.h:284

Returns a reference to the JSON array of all values.


{#value-4}

value

const nodiscard

[[nodiscard]] std::string value() const

Defined in src/symple/include/icy/symple/form.h:288

Returns the first value as a string. Most field types (except multi-value) only use a single value.


{#intvalue}

intValue

const nodiscard

[[nodiscard]] int intValue() const

Defined in src/symple/include/icy/symple/form.h:291

Returns the first value parsed as an integer.


{#doublevalue}

doubleValue

const nodiscard

[[nodiscard]] double doubleValue() const

Defined in src/symple/include/icy/symple/form.h:294

Returns the first value parsed as a double.


{#boolvalue}

boolValue

const nodiscard

[[nodiscard]] bool boolValue() const

Defined in src/symple/include/icy/symple/form.h:298

Returns the first value parsed as a boolean. Treats "1", "true", and "on" as true; all other strings as false.

{#message-10}

Message

#include <icy/symple/message.h>
class Message

Defined in src/symple/include/icy/symple/message.h:27

Inherits: Value, IPacket Subclassed by: Command, Event, Presence

Base Symple protocol message with addressing, status, data, and notes.

List of all members

NameKindOwner
MessagefunctionDeclared here
MessagefunctionDeclared here
MessagefunctionDeclared here
clonefunctionDeclared here
validfunctionDeclared here
clearfunctionDeclared here
clearDatafunctionDeclared here
clearNotesfunctionDeclared here
typefunctionDeclared here
idfunctionDeclared here
tofunctionDeclared here
fromfunctionDeclared here
toUserfunctionDeclared here
toIdfunctionDeclared here
fromUserfunctionDeclared here
fromIdfunctionDeclared here
statusfunctionDeclared here
setTypefunctionDeclared here
setTofunctionDeclared here
setTofunctionDeclared here
setTofunctionDeclared here
setFromfunctionDeclared here
setFromfunctionDeclared here
setFromfunctionDeclared here
setStatusfunctionDeclared here
notesfunctionDeclared here
setNotefunctionDeclared here
addNotefunctionDeclared here
datafunctionDeclared here
datafunctionDeclared here
setDatafunctionDeclared here
setDatafunctionDeclared here
setDatafunctionDeclared here
setDatafunctionDeclared here
setDatafunctionDeclared here
removeDatafunctionDeclared here
hasDatafunctionDeclared here
readfunctionDeclared here
readfunctionDeclared here
writefunctionDeclared here
isRequestfunctionDeclared here
sizefunctionDeclared here
printfunctionDeclared here
classNamefunctionDeclared here
datafunctionDeclared here
hasDatafunctionDeclared here
opaquevariableInherited from IPacket
infovariableInherited from IPacket
flagsvariableInherited from IPacket
IPacketfunctionInherited from IPacket
IPacketfunctionInherited from IPacket
operator=functionInherited from IPacket
clonefunctionInherited from IPacket
~IPacketfunctionInherited from IPacket
readfunctionInherited from IPacket
writefunctionInherited from IPacket
sizefunctionInherited from IPacket
hasDatafunctionInherited from IPacket
datafunctionInherited from IPacket
constDatafunctionInherited from IPacket
classNamefunctionInherited from IPacket
printfunctionInherited from IPacket
operator<<friendInherited from IPacket

Inherited from IPacket

KindNameDescription
variableopaqueOptional type-safe context data. Use std::any_cast to retrieve. Lifetime of the stored value is tied to the packet's lifetime.
variableinfoOptional extra information about the packet.
variableflagsProvides basic information about the packet.
functionIPacket inline
functionIPacket inlineCopy constructor; clones the info object if present.
functionoperator= inlineCopy assignment; clones the info object if present.
functionclone virtual constReturns a heap-allocated deep copy of this packet.
function~IPacket virtualDefaulted destructor.
functionread virtualRead/parse to the packet from the given input buffer. The number of bytes read is returned.
functionwrite virtual constCopy/generate to the packet given output buffer. The number of bytes written can be obtained from the buffer.
functionsize virtual const inlineThe size of the packet in bytes.
functionhasData virtual const inlineReturns true if the packet has a non-null data pointer.
functiondata virtual const inlineThe packet data pointer for buffered packets.
functionconstData virtual const inlineThe const packet data pointer for buffered packets.
functionclassName virtual constReturns the class name of this packet type for logging and diagnostics.
functionprint virtual const inlinePrints a human-readable representation to the given stream.
friendoperator<< inlineStream insertion operator; delegates to print().

Public Methods

ReturnNameDescription
MessageConstructs a new message with a random ID and type set to "message".
MessageConstructs a message from a JSON value; sets missing id/type fields.
MessageCopy constructor; preserves or generates id/type fields.
std::unique_ptr< IPacket >clone virtual const overrideReturns a heap-allocated copy of this message.
boolvalid virtual constReturns true if the message has both [type](#type-22) and [id](#id-7) fields.
voidclear virtualClears all JSON fields from this message.
voidclearData virtualClears the [data](#data-4) sub-object.
voidclearNotes virtualClears the [notes](#notes) array.
std::stringtype const nodiscardReturns the message type string (defaults to "message").
std::stringid const nodiscardReturns the message ID string.
Addressto const nodiscardReturns the recipient address parsed from the [to](#to) field.
Addressfrom const nodiscardReturns the sender address parsed from the [from](#from) field.
std::stringtoUser const nodiscardReturns the user component of the [to](#to) address without constructing an Address.
std::stringtoId const nodiscardReturns the id component of the [to](#to) address without constructing an Address.
std::stringfromUser const nodiscardReturns the user component of the [from](#from) address without constructing an Address.
std::stringfromId const nodiscardReturns the id component of the [from](#from) address without constructing an Address.
intstatus const nodiscardReturns the HTTP status code, or -1 if not set.
voidsetTypeSets the message type field.
voidsetToSets the [to](#to) field from a peer's address.
voidsetToSets the [to](#to) field from an address object.
voidsetToSets the [to](#to) field from an address string.
voidsetFromSets the [from](#from) field from a peer's address.
voidsetFromSets the [from](#from) field from an address object.
voidsetFromSets the [from](#from) field from an address string.
voidsetStatusHTTP status codes are used to describe the message response. Throws std::invalid_argument if code is outside [101, 504].
json::Value &notesReturns a reference to the [notes](#notes) JSON array.
voidsetNoteReplaces all notes with a single note.
voidaddNoteAppends a note to the [notes](#notes) array.
json::Valuedata constReturns a copy of the named data field.
json::Value &dataReturns a reference to the named data field (creates it if absent).
json::Value &setDataCreates or replaces a named data field; returns a reference to it.
voidsetDataSets a named data field to a C-string value.
voidsetDataSets a named data field to a string value.
voidsetDataSets a named data field to a JSON value.
voidsetDataSets a named data field to an integer value.
voidremoveDataRemoves a named field from the [data](#data-4) sub-object.
boolhasDataReturns true if the named field exists in the [data](#data-4) sub-object.
ssize_tread virtual overrideDeserialises the message from a raw buffer.
ssize_tread virtualDeserialises the message from a JSON string.
voidwrite virtual const overrideSerialises the message as JSON into a buffer.
boolisRequest const nodiscardReturns true if no status code has been set (i.e. status() == -1).
size_tsize virtual const overrideReturns the serialised JSON size in bytes.
voidprint virtual const overridePretty-prints the message JSON to the given stream.
const char *className virtual const inline overrideReturns the class name of this packet type for logging and diagnostics.
char *data virtual const inlineThe packet data pointer for buffered packets.
boolhasData virtual const inlineReturns true if the packet has a non-null data pointer.

{#message-11}

Message

Message()

Defined in src/symple/include/icy/symple/message.h:35

Constructs a new message with a random ID and type set to "message".


{#message-12}

Message

Message(const json::Value & root)

Defined in src/symple/include/icy/symple/message.h:39

Constructs a message from a JSON value; sets missing id/type fields.

Parameters

  • root JSON object to initialise from.

{#message-13}

Message

Message(const Message & root)

Defined in src/symple/include/icy/symple/message.h:43

Copy constructor; preserves or generates id/type fields.

Parameters

  • root Source message.

{#clone-18}

clone

virtual const override

virtual std::unique_ptr< IPacket > clone() const override

Defined in src/symple/include/icy/symple/message.h:49

Returns a heap-allocated copy of this message.

Reimplements

{#valid-15}

valid

virtual const

virtual bool valid() const

Defined in src/symple/include/icy/symple/message.h:52

Returns true if the message has both [type](#type-22) and [id](#id-7) fields.

Reimplemented by

{#clear-4}

clear

virtual

virtual void clear()

Defined in src/symple/include/icy/symple/message.h:55

Clears all JSON fields from this message.


{#cleardata}

clearData

virtual

virtual void clearData()

Defined in src/symple/include/icy/symple/message.h:58

Clears the [data](#data-4) sub-object.


{#clearnotes}

clearNotes

virtual

virtual void clearNotes()

Defined in src/symple/include/icy/symple/message.h:61

Clears the [notes](#notes) array.


{#type-22}

type

const nodiscard

[[nodiscard]] std::string type() const

Defined in src/symple/include/icy/symple/message.h:64

Returns the message type string (defaults to "message").


{#id-7}

id

const nodiscard

[[nodiscard]] std::string id() const

Defined in src/symple/include/icy/symple/message.h:67

Returns the message ID string.


{#to}

to

const nodiscard

[[nodiscard]] Address to() const

Defined in src/symple/include/icy/symple/message.h:70

Returns the recipient address parsed from the [to](#to) field.


{#from}

from

const nodiscard

[[nodiscard]] Address from() const

Defined in src/symple/include/icy/symple/message.h:73

Returns the sender address parsed from the [from](#from) field.


{#touser}

toUser

const nodiscard

[[nodiscard]] std::string toUser() const

Defined in src/symple/include/icy/symple/message.h:76

Returns the user component of the [to](#to) address without constructing an Address.


{#toid}

toId

const nodiscard

[[nodiscard]] std::string toId() const

Defined in src/symple/include/icy/symple/message.h:79

Returns the id component of the [to](#to) address without constructing an Address.


{#fromuser}

fromUser

const nodiscard

[[nodiscard]] std::string fromUser() const

Defined in src/symple/include/icy/symple/message.h:82

Returns the user component of the [from](#from) address without constructing an Address.


{#fromid}

fromId

const nodiscard

[[nodiscard]] std::string fromId() const

Defined in src/symple/include/icy/symple/message.h:85

Returns the id component of the [from](#from) address without constructing an Address.


{#status-3}

status

const nodiscard

[[nodiscard]] int status() const

Defined in src/symple/include/icy/symple/message.h:88

Returns the HTTP status code, or -1 if not set.


{#settype-2}

setType

void setType(std::string_view type)

Defined in src/symple/include/icy/symple/message.h:92

Sets the message type field.

Parameters

  • type Type string (e.g. "message", "command").

{#setto}

setTo

void setTo(const Peer & to)

Defined in src/symple/include/icy/symple/message.h:96

Sets the [to](#to) field from a peer's address.

Parameters

  • to Destination peer.

{#setto-1}

setTo

void setTo(const Address & to)

Defined in src/symple/include/icy/symple/message.h:100

Sets the [to](#to) field from an address object.

Parameters

  • to Destination address.

{#setto-2}

setTo

void setTo(std::string_view to)

Defined in src/symple/include/icy/symple/message.h:104

Sets the [to](#to) field from an address string.

Parameters

  • to Destination address string.

{#setfrom}

setFrom

void setFrom(const Peer & from)

Defined in src/symple/include/icy/symple/message.h:108

Sets the [from](#from) field from a peer's address.

Parameters

  • from Sender peer.

{#setfrom-1}

setFrom

void setFrom(const Address & from)

Defined in src/symple/include/icy/symple/message.h:112

Sets the [from](#from) field from an address object.

Parameters

  • from Sender address.

{#setfrom-2}

setFrom

void setFrom(std::string_view from)

Defined in src/symple/include/icy/symple/message.h:116

Sets the [from](#from) field from an address string.

Parameters

  • from Sender address string.

{#setstatus-1}

setStatus

void setStatus(int code)

Defined in src/symple/include/icy/symple/message.h:122

HTTP status codes are used to describe the message response. Throws std::invalid_argument if code is outside [101, 504].

Parameters

  • code HTTP status code.

See also: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html


{#notes}

notes

json::Value & notes()

Defined in src/symple/include/icy/symple/message.h:125

Returns a reference to the [notes](#notes) JSON array.


{#setnote}

setNote

void setNote(std::string_view type, std::string_view text)

Defined in src/symple/include/icy/symple/message.h:130

Replaces all notes with a single note.

Parameters

  • type Note severity: [info](base.md#classicy_1_1IPacket_1ac2231c52e60bf60b402bc95cc9d6607d), warn, or error.

  • text Note message text.


{#addnote}

addNote

void addNote(std::string_view type, std::string_view text)

Defined in src/symple/include/icy/symple/message.h:135

Appends a note to the [notes](#notes) array.

Parameters

  • type Note severity: [info](base.md#classicy_1_1IPacket_1ac2231c52e60bf60b402bc95cc9d6607d), warn, or error.

  • text Note message text.


{#data-4}

data

const

json::Value data(std::string_view name) const

Defined in src/symple/include/icy/symple/message.h:139

Returns a copy of the named data field.

Parameters

  • name Field name within [data](#data-4).

{#data-5}

data

json::Value & data(std::string_view name)

Defined in src/symple/include/icy/symple/message.h:143

Returns a reference to the named data field (creates it if absent).

Parameters

  • name Field name within [data](#data-4).

{#setdata}

setData

json::Value & setData(std::string_view name)

Defined in src/symple/include/icy/symple/message.h:147

Creates or replaces a named data field; returns a reference to it.

Parameters

  • name Field name within [data](#data-4).

{#setdata-1}

setData

void setData(std::string_view name, const char * data)

Defined in src/symple/include/icy/symple/message.h:152

Sets a named data field to a C-string value.

Parameters

  • name Field name within [data](#data-4).

  • data String value to assign.


{#setdata-2}

setData

void setData(std::string_view name, std::string_view data)

Defined in src/symple/include/icy/symple/message.h:157

Sets a named data field to a string value.

Parameters

  • name Field name within [data](#data-4).

  • data String value to assign.


{#setdata-3}

setData

void setData(std::string_view name, const json::Value & data)

Defined in src/symple/include/icy/symple/message.h:162

Sets a named data field to a JSON value.

Parameters

  • name Field name within [data](#data-4).

  • data JSON value to assign.


{#setdata-4}

setData

void setData(std::string_view name, int data)

Defined in src/symple/include/icy/symple/message.h:167

Sets a named data field to an integer value.

Parameters

  • name Field name within [data](#data-4).

  • data Integer value to assign.


{#removedata}

removeData

void removeData(std::string_view name)

Defined in src/symple/include/icy/symple/message.h:171

Removes a named field from the [data](#data-4) sub-object.

Parameters

  • name Field name to remove.

{#hasdata}

hasData

bool hasData(std::string_view name)

Defined in src/symple/include/icy/symple/message.h:175

Returns true if the named field exists in the [data](#data-4) sub-object.

Parameters

  • name Field name to look up.

{#read-13}

read

virtual override

virtual ssize_t read(const ConstBuffer & buf) override

Defined in src/symple/include/icy/symple/message.h:180

Deserialises the message from a raw buffer.

Parameters

  • buf Buffer containing the JSON payload.

Returns

Number of bytes consumed.

Reimplements

{#read-14}

read

virtual

virtual ssize_t read(const std::string & root)

Defined in src/symple/include/icy/symple/message.h:185

Deserialises the message from a JSON string.

Parameters

  • root JSON string to parse.

Returns

Number of characters consumed.


{#write-28}

write

virtual const override

virtual void write(Buffer & buf) const override

Defined in src/symple/include/icy/symple/message.h:189

Serialises the message as JSON into a buffer.

Parameters

Reimplements

{#isrequest}

isRequest

const nodiscard

[[nodiscard]] bool isRequest() const

Defined in src/symple/include/icy/symple/message.h:192

Returns true if no status code has been set (i.e. status() == -1).


{#size-12}

size

virtual const override

virtual size_t size() const override

Defined in src/symple/include/icy/symple/message.h:195

Returns the serialised JSON size in bytes.

Reimplements

{#print-16}

print

virtual const override

virtual void print(std::ostream & os) const override

Defined in src/symple/include/icy/symple/message.h:199

Pretty-prints the message JSON to the given stream.

Parameters

  • os Output stream.
Reimplements

{#classname-8}

className

virtual const inline override

virtual inline const char * className() const override

Defined in src/symple/include/icy/symple/message.h:201

Returns the class name of this packet type for logging and diagnostics.

Reimplements

{#data-6}

data

virtual const inline

virtual inline char * data() const

Defined in src/symple/include/icy/symple/message.h:31

The packet data pointer for buffered packets.

Reimplements

{#hasdata-1}

hasData

virtual const inline

virtual inline bool hasData() const

Defined in src/symple/include/icy/symple/message.h:32

Returns true if the packet has a non-null data pointer.

Reimplements

{#peer-1}

Peer

#include <icy/symple/peer.h>
class Peer

Defined in src/symple/include/icy/symple/peer.h:30

Inherits: Value

Symple peer record containing identity, presence, and custom fields.

A Peer object may also contain arbitrary application data set by the client to share with other peers on the network. See also: Address for further methods and basic accessors.

List of all members

NameKindOwner
operator<<friendDeclared here
PeerfunctionDeclared here
PeerfunctionDeclared here
operator=functionDeclared here
PeerfunctionDeclared here
addressfunctionDeclared here
idfunctionDeclared here
userfunctionDeclared here
namefunctionDeclared here
typefunctionDeclared here
hostfunctionDeclared here
setIDfunctionDeclared here
setUserfunctionDeclared here
setNamefunctionDeclared here
setTypefunctionDeclared here
setHostfunctionDeclared here
validfunctionDeclared here
printfunctionDeclared here
classNamefunctionDeclared here

Friends

NameDescription
operator<< inline

{#operator-38}

operator<<

inline

friend inline std::ostream & operator<<(std::ostream & os, const Peer & peer)

Defined in src/symple/include/icy/symple/peer.h:101

Public Methods

ReturnNameDescription
PeerConstructs an empty peer with type set to "Peer".
PeerCopy constructor; preserves type field.
Peer &operator=Copy-assigns peer data from another peer.
PeerConstructs a peer from a raw JSON value.
Addressaddress const nodiscardReturns the peer's address (user + session ID).
std::stringid const nodiscardReturns the session ID assigned by the server.
std::stringuser const nodiscardReturns the user identifier.
std::stringname const nodiscardReturns the display name.
std::stringtype const nodiscardReturns the peer type string (e.g. "Peer", "bot").
std::stringhost const nodiscardReturns the host address associated with this peer.
voidsetIDSets the session ID field.
voidsetUserSets the user identifier field.
voidsetNameSets the display name field.
voidsetTypeSets the peer type field.
voidsetHostSets the host address field.
boolvalid virtualUpdates the peer from the given data object.
voidprint constWrites the peer's JSON representation to the given stream.
const char *className virtual const inline

{#peer-2}

Peer

Peer()

Defined in src/symple/include/icy/symple/peer.h:34

Constructs an empty peer with type set to "Peer".


{#peer-3}

Peer

Peer(const Peer & r)

Defined in src/symple/include/icy/symple/peer.h:38

Copy constructor; preserves type field.

Parameters

  • r Source peer.

{#operator-39}

operator=

Peer & operator=(const Peer & r)

Defined in src/symple/include/icy/symple/peer.h:42

Copy-assigns peer data from another peer.

Parameters

  • r Source peer.

{#peer-4}

Peer

Peer(const json::Value & r)

Defined in src/symple/include/icy/symple/peer.h:46

Constructs a peer from a raw JSON value.

Parameters

  • r JSON object containing peer fields.

{#address-17}

address

const nodiscard

[[nodiscard]] Address address() const

Defined in src/symple/include/icy/symple/peer.h:52

Returns the peer's address (user + session ID).

Returns

Address constructed from the [user](#user-2) and [id](#id-8) fields.


{#id-8}

id

const nodiscard

[[nodiscard]] std::string id() const

Defined in src/symple/include/icy/symple/peer.h:55

Returns the session ID assigned by the server.


{#user-2}

user

const nodiscard

[[nodiscard]] std::string user() const

Defined in src/symple/include/icy/symple/peer.h:58

Returns the user identifier.


{#name-14}

name

const nodiscard

[[nodiscard]] std::string name() const

Defined in src/symple/include/icy/symple/peer.h:61

Returns the display name.


{#type-23}

type

const nodiscard

[[nodiscard]] std::string type() const

Defined in src/symple/include/icy/symple/peer.h:65

Returns the peer type string (e.g. "Peer", "bot").


{#host-3}

host

const nodiscard

[[nodiscard]] std::string host() const

Defined in src/symple/include/icy/symple/peer.h:68

Returns the host address associated with this peer.


{#setid-1}

setID

void setID(std::string_view id)

Defined in src/symple/include/icy/symple/peer.h:72

Sets the session ID field.

Parameters

  • id Session ID string.

{#setuser}

setUser

void setUser(std::string_view user)

Defined in src/symple/include/icy/symple/peer.h:76

Sets the user identifier field.

Parameters

  • user User identifier string.

{#setname-3}

setName

void setName(std::string_view name)

Defined in src/symple/include/icy/symple/peer.h:80

Sets the display name field.

Parameters

  • name Display name string.

{#settype-3}

setType

void setType(std::string_view type)

Defined in src/symple/include/icy/symple/peer.h:85

Sets the peer type field.

Parameters

  • type Type string.

{#sethost-2}

setHost

void setHost(std::string_view host)

Defined in src/symple/include/icy/symple/peer.h:89

Sets the host address field.

Parameters

  • host Host address string.

{#valid-16}

valid

virtual

virtual bool valid()

Defined in src/symple/include/icy/symple/peer.h:95

Updates the peer from the given data object.

Returns true if the peer has [id](#id-8), [user](#user-2), and [type](#type-23) fields.


{#print-17}

const

void print(std::ostream & os) const

Defined in src/symple/include/icy/symple/peer.h:99

Writes the peer's JSON representation to the given stream.

Parameters

  • os Output stream.

{#classname-9}

className

virtual const inline

virtual inline const char * className() const

Defined in src/symple/include/icy/symple/peer.h:107

{#presence}

Presence

#include <icy/symple/presence.h>
class Presence

Defined in src/symple/include/icy/symple/presence.h:27

Inherits: Message

Symple presence message indicating a peer's online status.

Presence messages carry peer data in the [data](#data-4) field. When probe is true the recipient should respond with their own presence.

List of all members

NameKindOwner
PresencefunctionDeclared here
PresencefunctionDeclared here
PresencefunctionDeclared here
isProbefunctionDeclared here
setProbefunctionDeclared here
MessagefunctionInherited from Message
MessagefunctionInherited from Message
MessagefunctionInherited from Message
clonefunctionInherited from Message
validfunctionInherited from Message
clearfunctionInherited from Message
clearDatafunctionInherited from Message
clearNotesfunctionInherited from Message
typefunctionInherited from Message
idfunctionInherited from Message
tofunctionInherited from Message
fromfunctionInherited from Message
toUserfunctionInherited from Message
toIdfunctionInherited from Message
fromUserfunctionInherited from Message
fromIdfunctionInherited from Message
statusfunctionInherited from Message
setTypefunctionInherited from Message
setTofunctionInherited from Message
setTofunctionInherited from Message
setTofunctionInherited from Message
setFromfunctionInherited from Message
setFromfunctionInherited from Message
setFromfunctionInherited from Message
setStatusfunctionInherited from Message
notesfunctionInherited from Message
setNotefunctionInherited from Message
addNotefunctionInherited from Message
datafunctionInherited from Message
datafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
removeDatafunctionInherited from Message
hasDatafunctionInherited from Message
readfunctionInherited from Message
readfunctionInherited from Message
writefunctionInherited from Message
isRequestfunctionInherited from Message
sizefunctionInherited from Message
printfunctionInherited from Message
classNamefunctionInherited from Message
datafunctionInherited from Message
hasDatafunctionInherited from Message
opaquevariableInherited from IPacket
infovariableInherited from IPacket
flagsvariableInherited from IPacket
IPacketfunctionInherited from IPacket
IPacketfunctionInherited from IPacket
operator=functionInherited from IPacket
clonefunctionInherited from IPacket
~IPacketfunctionInherited from IPacket
readfunctionInherited from IPacket
writefunctionInherited from IPacket
sizefunctionInherited from IPacket
hasDatafunctionInherited from IPacket
datafunctionInherited from IPacket
constDatafunctionInherited from IPacket
classNamefunctionInherited from IPacket
printfunctionInherited from IPacket
operator<<friendInherited from IPacket

Inherited from Message

KindNameDescription
functionMessageConstructs a new message with a random ID and type set to "message".
functionMessageConstructs a message from a JSON value; sets missing id/type fields.
functionMessageCopy constructor; preserves or generates id/type fields.
functionclone virtual const overrideReturns a heap-allocated copy of this message.
functionvalid virtual constReturns true if the message has both [type](#type-22) and [id](#id-7) fields.
functionclear virtualClears all JSON fields from this message.
functionclearData virtualClears the [data](#data-4) sub-object.
functionclearNotes virtualClears the [notes](#notes) array.
functiontype const nodiscardReturns the message type string (defaults to "message").
functionid const nodiscardReturns the message ID string.
functionto const nodiscardReturns the recipient address parsed from the [to](#to) field.
functionfrom const nodiscardReturns the sender address parsed from the [from](#from) field.
functiontoUser const nodiscardReturns the user component of the [to](#to) address without constructing an Address.
functiontoId const nodiscardReturns the id component of the [to](#to) address without constructing an Address.
functionfromUser const nodiscardReturns the user component of the [from](#from) address without constructing an Address.
functionfromId const nodiscardReturns the id component of the [from](#from) address without constructing an Address.
functionstatus const nodiscardReturns the HTTP status code, or -1 if not set.
functionsetTypeSets the message type field.
functionsetToSets the [to](#to) field from a peer's address.
functionsetToSets the [to](#to) field from an address object.
functionsetToSets the [to](#to) field from an address string.
functionsetFromSets the [from](#from) field from a peer's address.
functionsetFromSets the [from](#from) field from an address object.
functionsetFromSets the [from](#from) field from an address string.
functionsetStatusHTTP status codes are used to describe the message response. Throws std::invalid_argument if code is outside [101, 504].
functionnotesReturns a reference to the [notes](#notes) JSON array.
functionsetNoteReplaces all notes with a single note.
functionaddNoteAppends a note to the [notes](#notes) array.
functiondata constReturns a copy of the named data field.
functiondataReturns a reference to the named data field (creates it if absent).
functionsetDataCreates or replaces a named data field; returns a reference to it.
functionsetDataSets a named data field to a C-string value.
functionsetDataSets a named data field to a string value.
functionsetDataSets a named data field to a JSON value.
functionsetDataSets a named data field to an integer value.
functionremoveDataRemoves a named field from the [data](#data-4) sub-object.
functionhasDataReturns true if the named field exists in the [data](#data-4) sub-object.
functionread virtual overrideDeserialises the message from a raw buffer.
functionread virtualDeserialises the message from a JSON string.
functionwrite virtual const overrideSerialises the message as JSON into a buffer.
functionisRequest const nodiscardReturns true if no status code has been set (i.e. status() == -1).
functionsize virtual const overrideReturns the serialised JSON size in bytes.
functionprint virtual const overridePretty-prints the message JSON to the given stream.
functionclassName virtual const inline overrideReturns the class name of this packet type for logging and diagnostics.
functiondata virtual const inlineThe packet data pointer for buffered packets.
functionhasData virtual const inlineReturns true if the packet has a non-null data pointer.

Inherited from IPacket

KindNameDescription
variableopaqueOptional type-safe context data. Use std::any_cast to retrieve. Lifetime of the stored value is tied to the packet's lifetime.
variableinfoOptional extra information about the packet.
variableflagsProvides basic information about the packet.
functionIPacket inline
functionIPacket inlineCopy constructor; clones the info object if present.
functionoperator= inlineCopy assignment; clones the info object if present.
functionclone virtual constReturns a heap-allocated deep copy of this packet.
function~IPacket virtualDefaulted destructor.
functionread virtualRead/parse to the packet from the given input buffer. The number of bytes read is returned.
functionwrite virtual constCopy/generate to the packet given output buffer. The number of bytes written can be obtained from the buffer.
functionsize virtual const inlineThe size of the packet in bytes.
functionhasData virtual const inlineReturns true if the packet has a non-null data pointer.
functiondata virtual const inlineThe packet data pointer for buffered packets.
functionconstData virtual const inlineThe const packet data pointer for buffered packets.
functionclassName virtual constReturns the class name of this packet type for logging and diagnostics.
functionprint virtual const inlinePrints a human-readable representation to the given stream.
friendoperator<< inlineStream insertion operator; delegates to print().

Public Methods

ReturnNameDescription
PresenceConstructs a presence message with type set to "presence".
PresenceConstructs a presence message from a JSON value.
PresenceCopy constructor.
boolisProbeReturns true if this is a presence probe request. Recipients of a probe should send back their own presence.
voidsetProbeSets or clears the probe flag on this presence message.

{#presence-1}

Presence

Presence()

Defined in src/symple/include/icy/symple/presence.h:31

Constructs a presence message with type set to "presence".


{#presence-2}

Presence

Presence(const json::Value & root)

Defined in src/symple/include/icy/symple/presence.h:35

Constructs a presence message from a JSON value.

Parameters

  • root JSON object to initialise from.

{#presence-3}

Presence

Presence(const Presence & root)

Defined in src/symple/include/icy/symple/presence.h:39

Copy constructor.

Parameters

  • root Source presence message.

{#isprobe}

isProbe

bool isProbe()

Defined in src/symple/include/icy/symple/presence.h:45

Returns true if this is a presence probe request. Recipients of a probe should send back their own presence.


{#setprobe}

setProbe

void setProbe(bool flag)

Defined in src/symple/include/icy/symple/presence.h:49

Sets or clears the probe flag on this presence message.

Parameters

  • flag True to mark this as a probe.

{#roster-2}

Roster

#include <icy/symple/roster.h>
class Roster

Defined in src/symple/include/icy/symple/roster.h:29

Inherits: string, Peer >

The Roster provides a registry for active network peers indexed by session ID.

List of all members

NameKindOwner
PeerAddedvariableDeclared here
PeerRemovedvariableDeclared here
RosterfunctionDeclared here
getByHostfunctionDeclared here
peersfunctionDeclared here
printfunctionDeclared here
classNamefunctionDeclared here
onAddfunctionDeclared here
onRemovefunctionDeclared here
MaptypedefInherited from KeyedStore
_mapvariableInherited from KeyedStore
KeyedStorefunctionInherited from KeyedStore
~KeyedStorefunctionInherited from KeyedStore
KeyedStorefunctionInherited from KeyedStore
operator=functionInherited from KeyedStore
KeyedStorefunctionInherited from KeyedStore
operator=functionInherited from KeyedStore
getfunctionInherited from KeyedStore
addfunctionInherited from KeyedStore
tryAddfunctionInherited from KeyedStore
putfunctionInherited from KeyedStore
erasefunctionInherited from KeyedStore
containsfunctionInherited from KeyedStore
emptyfunctionInherited from KeyedStore
sizefunctionInherited from KeyedStore
clearfunctionInherited from KeyedStore
mapfunctionInherited from KeyedStore
mapfunctionInherited from KeyedStore
beginfunctionInherited from KeyedStore
endfunctionInherited from KeyedStore
beginfunctionInherited from KeyedStore
endfunctionInherited from KeyedStore
onAddfunctionInherited from KeyedStore
onRemovefunctionInherited from KeyedStore

Inherited from KeyedStore

KindNameDescription
typedefMap
variable_map
functionKeyedStoreDefaulted constructor.
function~KeyedStore virtual inline
functionKeyedStoreDeleted constructor.
functionoperator=Deleted assignment operator.
functionKeyedStoreDefaulted constructor.
functionoperator=Defaulted assignment operator.
functionget const inlineReturns the item for key, or nullptr if not found.
functionadd inlineInserts a uniquely owned item. Returns a reference to the stored item.
functiontryAdd inlineInserts if absent; returns false on duplicate (never throws).
functionput inlineInserts or replaces the item under key.
functionerase inlineRemoves and destroys the item under key.
functioncontains const inline
functionempty const inline
functionsize const inline
functionclear inline
functionmap inlineDirect map access for iteration.
functionmap const inline
functionbegin inline
functionend inline
functionbegin const inline
functionend const inline
functiononAdd virtual inlineOverride for lifecycle reactions.
functiononRemove virtual inline

Public Attributes

ReturnNameDescription
Signal< void(Peer &)>PeerAddedLifecycle signals for external observers (samples, UI).
Signal< void(const Peer &)>PeerRemoved

{#peeradded}

PeerAdded

Signal< void(Peer &)> PeerAdded

Defined in src/symple/include/icy/symple/roster.h:46

Lifecycle signals for external observers (samples, UI).


{#peerremoved}

PeerRemoved

Signal< void(const Peer &)> PeerRemoved

Defined in src/symple/include/icy/symple/roster.h:47

Public Methods

ReturnNameDescription
Roster
Peer *getByHostReturns the first peer which matches the given host address.
Mappeers const nodiscardReturns a deep copy of the peer map.
voidprint const
const char *className virtual const inline

{#roster-3}

Roster

Roster()

Defined in src/symple/include/icy/symple/roster.h:32


{#getbyhost}

getByHost

Peer * getByHost(std::string_view host)

Defined in src/symple/include/icy/symple/roster.h:36

Returns the first peer which matches the given host address.


{#peers}

peers

const nodiscard

[[nodiscard]] Map peers() const

Defined in src/symple/include/icy/symple/roster.h:39

Returns a deep copy of the peer map.


{#print-18}

const

void print(std::ostream & os) const

Defined in src/symple/include/icy/symple/roster.h:41


{#classname-10}

className

virtual const inline

virtual inline const char * className() const

Defined in src/symple/include/icy/symple/roster.h:43

Protected Methods

ReturnNameDescription
voidonAdd inline override
voidonRemove inline override

{#onadd}

onAdd

inline override

inline void onAdd(const std::string &, Peer * peer) override

Defined in src/symple/include/icy/symple/roster.h:50


{#onremove}

onRemove

inline override

inline void onRemove(const std::string &, Peer * peer) override

Defined in src/symple/include/icy/symple/roster.h:51

{#server-10}

Server

#include <icy/symple/server.h>
class Server

Defined in src/symple/include/icy/symple/server.h:136

Symple v4 server.

Accepts WebSocket connections, authenticates peers, manages rooms, and routes messages. Implements the Symple v4 protocol over native WebSocket.

Usage: smpl::Server server; server.start({.port = 4500});

// Optional: custom authentication server.Authenticate += [](ServerPeer& peer, const json::Value& auth, bool& allowed, std::vectorstd::string& rooms) { allowed = (auth.value("token", "") == "secret"); rooms.push_back("team-a"); };

The server also serves as an HTTP server, so you can serve static files (e.g. a web UI) on the same port.

List of all members

NameKindOwner
FactoryfriendDeclared here
AuthenticatevariableDeclared here
PeerConnectedvariableDeclared here
PeerDisconnectedvariableDeclared here
ServerfunctionDeclared here
ServerfunctionDeclared here
startfunctionDeclared here
startfunctionDeclared here
stopfunctionDeclared here
broadcastfunctionDeclared here
broadcastRoomsfunctionDeclared here
sendTofunctionDeclared here
sendToUserfunctionDeclared here
getPeerfunctionDeclared here
getPeersInRoomfunctionDeclared here
peerCountfunctionDeclared here
addVirtualPeerfunctionDeclared here
removeVirtualPeerfunctionDeclared here
httpServerfunctionDeclared here
loopfunctionDeclared here
_optsvariableDeclared here
_loopvariableDeclared here
_httpvariableDeclared here
_peerRegistryvariableDeclared here
_roomIndexvariableDeclared here
_mutexvariableDeclared here
_shuttingDownvariableDeclared here
_httpFallbackvariableDeclared here
onAuthfunctionDeclared here
onMessagefunctionDeclared here
onJoinfunctionDeclared here
onLeavefunctionDeclared here
onDisconnectfunctionDeclared here
routefunctionDeclared here
deliverfunctionDeclared here
deliverSerializedfunctionDeclared here
sendPresenceSnapshotfunctionDeclared here

Friends

NameDescription
Factory

{#factory-2}

Factory

friend class Factory

Defined in src/symple/include/icy/symple/server.h:279

Public Attributes

ReturnNameDescription
Signal< void(ServerPeer &, const json::Value &auth, bool &allowed, std::vector< std::string > &rooms)>AuthenticateCustom authentication hook. Set allowed to false to reject the peer. Append to rooms to assign team/group memberships. If not connected, all peers with a valid user field are accepted.
Signal< void(ServerPeer &)>PeerConnectedPeer authenticated and online.
Signal< void(ServerPeer &)>PeerDisconnectedPeer disconnected.

{#authenticate-2}

Authenticate

Signal< void(ServerPeer &, const json::Value &auth, bool &allowed, std::vector< std::string > &rooms)> Authenticate

Defined in src/symple/include/icy/symple/server.h:213

Custom authentication hook. Set allowed to false to reject the peer. Append to rooms to assign team/group memberships. If not connected, all peers with a valid user field are accepted.


{#peerconnected-1}

PeerConnected

Signal< void(ServerPeer &)> PeerConnected

Defined in src/symple/include/icy/symple/server.h:216

Peer authenticated and online.


{#peerdisconnected-1}

PeerDisconnected

Signal< void(ServerPeer &)> PeerDisconnected

Defined in src/symple/include/icy/symple/server.h:219

Peer disconnected.

Public Methods

ReturnNameDescription
ServerConstructs a server using the given event loop.
ServerDeleted constructor.
voidstartStarts the server with the given options. Begins accepting WebSocket connections on opts.host:opts.port.
voidstartStarts the server with a custom HTTP factory for non-WebSocket requests. The Symple server handles WebSocket upgrades internally; any other HTTP request (e.g. static files, REST API) is delegated to this factory.
voidstopBroadcasts a shutdown notice to all peers, closes the listen socket, and releases all internal state. Safe to call more than once.
voidbroadcastBroadcast a message to all peers in a room (excluding sender).
voidbroadcastRoomsBroadcast to multiple rooms with per-recipient dedup.
boolsendToSend a message to a specific peer by session ID.
boolsendToUserSend a message to any peer with the given user name.
ServerPeer *getPeer nodiscardGet a connected peer by session ID.
std::vector< ServerPeer * >getPeersInRoom nodiscardGet all peers in a room.
size_tpeerCount const nodiscardNumber of connected, authenticated peers.
voidaddVirtualPeerRegister a virtual peer that receives messages via callback.
voidremoveVirtualPeerRemove a virtual peer by session ID.
http::Server &httpServer inline nodiscardAccess the underlying HTTP server (e.g. to serve static files).
uv::Loop *loop const inline nodiscardEvent loop that owns the Symple server and all peer connections.

{#server-11}

Server

Server(uv::Loop * loop = uv::defaultLoop())

Defined in src/symple/include/icy/symple/server.h:157

Constructs a server using the given event loop.

Parameters


{#server-12}

Server

Server(const Server &) = delete

Defined in src/symple/include/icy/symple/server.h:160

Deleted constructor.


{#start-17}

start

void start(const Options & opts)

Defined in src/symple/include/icy/symple/server.h:166

Starts the server with the given options. Begins accepting WebSocket connections on opts.host:opts.port.

Parameters

  • opts Server configuration options.

{#start-18}

start

void start(const Options & opts, std::unique_ptr< http::ServerConnectionFactory > httpFactory)

Defined in src/symple/include/icy/symple/server.h:173

Starts the server with a custom HTTP factory for non-WebSocket requests. The Symple server handles WebSocket upgrades internally; any other HTTP request (e.g. static files, REST API) is delegated to this factory.

Parameters

  • opts Server configuration options.

  • httpFactory Factory for HTTP responders; may be nullptr.


{#stop-14}

stop

void stop()

Defined in src/symple/include/icy/symple/server.h:178

Broadcasts a shutdown notice to all peers, closes the listen socket, and releases all internal state. Safe to call more than once.


{#broadcast}

broadcast

void broadcast(const std::string & room, const json::Value & msg, const std::string & excludeId = {})

Defined in src/symple/include/icy/symple/server.h:182

Broadcast a message to all peers in a room (excluding sender).


{#broadcastrooms}

broadcastRooms

void broadcastRooms(const std::unordered_set< std::string > & rooms, const json::Value & msg, const std::string & excludeId = {})

Defined in src/symple/include/icy/symple/server.h:186

Broadcast to multiple rooms with per-recipient dedup.


{#sendto}

sendTo

bool sendTo(const std::string & peerId, const json::Value & msg)

Defined in src/symple/include/icy/symple/server.h:191

Send a message to a specific peer by session ID.


{#sendtouser}

sendToUser

bool sendToUser(const std::string & user, const json::Value & msg)

Defined in src/symple/include/icy/symple/server.h:194

Send a message to any peer with the given user name.


{#getpeer}

getPeer

nodiscard

[[nodiscard]] ServerPeer * getPeer(const std::string & id)

Defined in src/symple/include/icy/symple/server.h:197

Get a connected peer by session ID.


{#getpeersinroom}

getPeersInRoom

nodiscard

[[nodiscard]] std::vector< ServerPeer * > getPeersInRoom(const std::string & room)

Defined in src/symple/include/icy/symple/server.h:200

Get all peers in a room.


{#peercount}

peerCount

const nodiscard

[[nodiscard]] size_t peerCount() const

Defined in src/symple/include/icy/symple/server.h:203

Number of connected, authenticated peers.


{#addvirtualpeer}

addVirtualPeer

void addVirtualPeer(const Peer & peer, const std::vector< std::string > & rooms, std::function< void(const json::Value &)> handler)

Defined in src/symple/include/icy/symple/server.h:230

Register a virtual peer that receives messages via callback.

The virtual peer appears in presence broadcasts and is routable like any WebSocket-connected peer. Messages addressed to it are delivered via the callback instead of a WebSocket connection.

Parameters

  • peer Peer data (must have "id", "user", "name" fields).

  • rooms Rooms the virtual peer joins.

  • handler Called when a message is routed to this peer.


{#removevirtualpeer}

removeVirtualPeer

void removeVirtualPeer(const std::string & peerId)

Defined in src/symple/include/icy/symple/server.h:235

Remove a virtual peer by session ID.


{#httpserver}

httpServer

inline nodiscard

[[nodiscard]] inline http::Server & httpServer()

Defined in src/symple/include/icy/symple/server.h:238

Access the underlying HTTP server (e.g. to serve static files).


{#loop-9}

loop

const inline nodiscard

[[nodiscard]] inline uv::Loop * loop() const

Defined in src/symple/include/icy/symple/server.h:241

Event loop that owns the Symple server and all peer connections.

Private Attributes

ReturnNameDescription
Options_opts
uv::Loop *_loop
std::unique_ptr< http::Server >_http
std::unique_ptr< PeerRegistry >_peerRegistry
std::unique_ptr< RoomIndex >_roomIndex
std::mutex_mutex
std::atomic< bool >_shuttingDown
std::unique_ptr< http::ServerConnectionFactory >_httpFallbackFallback factory for non-WebSocket HTTP requests.

{#_opts}

_opts

Options _opts

Defined in src/symple/include/icy/symple/server.h:267


{#_loop-3}

_loop

uv::Loop * _loop = nullptr

Defined in src/symple/include/icy/symple/server.h:268


{#_http}

_http

std::unique_ptr< http::Server > _http

Defined in src/symple/include/icy/symple/server.h:269


{#_peerregistry}

_peerRegistry

std::unique_ptr< PeerRegistry > _peerRegistry

Defined in src/symple/include/icy/symple/server.h:270


{#_roomindex}

_roomIndex

std::unique_ptr< RoomIndex > _roomIndex

Defined in src/symple/include/icy/symple/server.h:271


{#_mutex-16}

_mutex

std::mutex _mutex

Defined in src/symple/include/icy/symple/server.h:273


{#_shuttingdown}

_shuttingDown

std::atomic< bool > _shuttingDown {false}

Defined in src/symple/include/icy/symple/server.h:274


{#_httpfallback}

_httpFallback

std::unique_ptr< http::ServerConnectionFactory > _httpFallback

Defined in src/symple/include/icy/symple/server.h:277

Fallback factory for non-WebSocket HTTP requests.

Private Methods

ReturnNameDescription
voidonAuth
voidonMessage
voidonJoin
voidonLeave
voidonDisconnect
voidroute
booldeliver
booldeliverSerialized
voidsendPresenceSnapshot

{#onauth}

onAuth

void onAuth(ServerPeer & peer, const json::Value & msg, std::unique_lock< std::mutex > & lock)

Defined in src/symple/include/icy/symple/server.h:252


{#onmessage}

onMessage

void onMessage(ServerPeer & peer, json::Value msg)

Defined in src/symple/include/icy/symple/server.h:253


{#onjoin}

onJoin

void onJoin(ServerPeer & peer, const std::string & room)

Defined in src/symple/include/icy/symple/server.h:254


{#onleave}

onLeave

void onLeave(ServerPeer & peer, const std::string & room)

Defined in src/symple/include/icy/symple/server.h:255


{#ondisconnect}

onDisconnect

void onDisconnect(ServerPeer & peer, std::unique_lock< std::mutex > & lock)

Defined in src/symple/include/icy/symple/server.h:256


{#route}

route

void route(ServerPeer & sender, const json::Value & msg)

Defined in src/symple/include/icy/symple/server.h:257


{#deliver}

deliver

bool deliver(const std::string & peerId, const json::Value & msg)

Defined in src/symple/include/icy/symple/server.h:258


{#deliverserialized}

deliverSerialized

bool deliverSerialized(const std::string & peerId, const char * data, size_t len, const json::Value & msg)

Defined in src/symple/include/icy/symple/server.h:259


{#sendpresencesnapshot}

sendPresenceSnapshot

void sendPresenceSnapshot(ServerPeer & recipient, const std::unordered_set< std::string > & rooms, std::string_view excludeId = {})

Defined in src/symple/include/icy/symple/server.h:263

{#peerregistry}

PeerRegistry

#include <src/symple/src/server/detail.h>
class PeerRegistry

Defined in src/symple/src/server/detail.h:27

List of all members

NameKindOwner
addfunctionDeclared here
addVirtualfunctionDeclared here
bindfunctionDeclared here
unbindfunctionDeclared here
erasefunctionDeclared here
eraseVirtualfunctionDeclared here
clearfunctionDeclared here
findfunctionDeclared here
findfunctionDeclared here
findVirtualfunctionDeclared here
findVirtualfunctionDeclared here
findByConnectionfunctionDeclared here
findByConnectionfunctionDeclared here
sizefunctionDeclared here
peersfunctionDeclared here
_peersvariableDeclared here
_virtualPeersvariableDeclared here
_connToPeervariableDeclared here

Public Methods

ReturnNameDescription
voidadd
voidaddVirtual
voidbind
voidunbind
voiderase
voideraseVirtual
voidclear
ServerPeer *find nodiscard
const ServerPeer *find const nodiscard
VirtualPeer *findVirtual nodiscard
const VirtualPeer *findVirtual const nodiscard
ServerPeer *findByConnection nodiscard
const ServerPeer *findByConnection const nodiscard
size_tsize const nodiscard
const std::unordered_map< std::string, std::unique_ptr< ServerPeer > > &peers const inline nodiscard

{#add-3}

add

void add(std::string id, std::unique_ptr< ServerPeer > peer)

Defined in src/symple/src/server/detail.h:30


{#addvirtual}

addVirtual

void addVirtual(std::string id, VirtualPeer peer)

Defined in src/symple/src/server/detail.h:31


{#bind-4}

bind

void bind(http::ServerConnection & conn, const std::string & id)

Defined in src/symple/src/server/detail.h:32


{#unbind}

unbind

void unbind(http::ServerConnection & conn)

Defined in src/symple/src/server/detail.h:33


{#erase}

erase

void erase(const std::string & id)

Defined in src/symple/src/server/detail.h:34


{#erasevirtual}

eraseVirtual

void eraseVirtual(const std::string & id)

Defined in src/symple/src/server/detail.h:35


{#clear-5}

clear

void clear()

Defined in src/symple/src/server/detail.h:36


{#find}

find

nodiscard

[[nodiscard]] ServerPeer * find(const std::string & id)

Defined in src/symple/src/server/detail.h:38


{#find-1}

find

const nodiscard

[[nodiscard]] const ServerPeer * find(const std::string & id) const

Defined in src/symple/src/server/detail.h:39


{#findvirtual}

findVirtual

nodiscard

[[nodiscard]] VirtualPeer * findVirtual(const std::string & id)

Defined in src/symple/src/server/detail.h:40


{#findvirtual-1}

findVirtual

const nodiscard

[[nodiscard]] const VirtualPeer * findVirtual(const std::string & id) const

Defined in src/symple/src/server/detail.h:41


{#findbyconnection}

findByConnection

nodiscard

[[nodiscard]] ServerPeer * findByConnection(http::ServerConnection & conn)

Defined in src/symple/src/server/detail.h:42


{#findbyconnection-1}

findByConnection

const nodiscard

[[nodiscard]] const ServerPeer * findByConnection(http::ServerConnection & conn) const

Defined in src/symple/src/server/detail.h:43


{#size-13}

size

const nodiscard

[[nodiscard]] size_t size() const

Defined in src/symple/src/server/detail.h:44


{#peers-1}

peers

const inline nodiscard

[[nodiscard]] inline const std::unordered_map< std::string, std::unique_ptr< ServerPeer > > & peers() const

Defined in src/symple/src/server/detail.h:46

Private Attributes

ReturnNameDescription
std::unordered_map< std::string, std::unique_ptr< ServerPeer > >_peers
std::unordered_map< std::string, VirtualPeer >_virtualPeers
std::unordered_map< http::ServerConnection *, std::string >_connToPeer

{#_peers}

_peers

std::unordered_map< std::string, std::unique_ptr< ServerPeer > > _peers

Defined in src/symple/src/server/detail.h:52


{#_virtualpeers}

_virtualPeers

std::unordered_map< std::string, VirtualPeer > _virtualPeers

Defined in src/symple/src/server/detail.h:53


{#_conntopeer}

_connToPeer

std::unordered_map< http::ServerConnection *, std::string > _connToPeer

Defined in src/symple/src/server/detail.h:54

{#roomindex}

RoomIndex

#include <src/symple/src/server/detail.h>
class RoomIndex

Defined in src/symple/src/server/detail.h:58

List of all members

NameKindOwner
joinfunctionDeclared here
leavefunctionDeclared here
leaveAllfunctionDeclared here
clearfunctionDeclared here
membersfunctionDeclared here
collectRecipientsfunctionDeclared here
MemberSettypedefDeclared here
_roomsvariableDeclared here

Public Methods

ReturnNameDescription
voidjoin
voidleave
voidleaveAll
voidclear
const MemberSet *members const nodiscard
std::unordered_set< std::string >collectRecipients const nodiscard

{#join}

join

void join(const std::string & room, const std::string & peerId)

Defined in src/symple/src/server/detail.h:63


{#leave}

leave

void leave(const std::string & room, const std::string & peerId)

Defined in src/symple/src/server/detail.h:64


{#leaveall}

leaveAll

void leaveAll(const std::string & peerId)

Defined in src/symple/src/server/detail.h:65


{#clear-6}

clear

void clear()

Defined in src/symple/src/server/detail.h:66


{#members}

members

const nodiscard

[[nodiscard]] const MemberSet * members(const std::string & room) const

Defined in src/symple/src/server/detail.h:68


{#collectrecipients}

collectRecipients

const nodiscard

[[nodiscard]] std::unordered_set< std::string > collectRecipients(const std::unordered_set< std::string > & rooms, std::string_view excludeId = {}) const

Defined in src/symple/src/server/detail.h:69

Public Types

NameDescription
MemberSet

{#memberset}

MemberSet

using MemberSet = std::unordered_set< std::string >

Defined in src/symple/src/server/detail.h:61

Private Attributes

ReturnNameDescription
std::unordered_map< std::string, MemberSet >_rooms

{#_rooms}

_rooms

std::unordered_map< std::string, MemberSet > _rooms

Defined in src/symple/src/server/detail.h:74

{#options-16}

Options

#include <icy/symple/server.h>
struct Options

Defined in src/symple/include/icy/symple/server.h:140

Configuration options for the Symple server.

List of all members

NameKindOwner
hostvariableDeclared here
portvariableDeclared here
socketvariableDeclared here
authenticationvariableDeclared here
dynamicRoomsvariableDeclared here
maxConnectionsvariableDeclared here
maxMessageSizevariableDeclared here
rateLimitvariableDeclared here
rateSecondsvariableDeclared here

Public Attributes

ReturnNameDescription
std::stringhost
uint16_tport
net::TCPSocket::PtrsocketOptional pre-created listen socket (e.g. SSLSocket for HTTPS/WSS).
boolauthenticationRequire token in auth message.
booldynamicRoomsAllow clients to join/leave rooms.
size_tmaxConnectionsMax WebSocket connections (0 = unlimited).
size_tmaxMessageSizeMax message payload in bytes (64KB default).
doublerateLimitMessages per rate window.
doublerateSecondsRate window in seconds.

{#host-4}

host

std::string host = "0.0.0.0"

Defined in src/symple/include/icy/symple/server.h:142


{#port-3}

port

uint16_t port = 4500

Defined in src/symple/include/icy/symple/server.h:143


{#socket-7}

socket

net::TCPSocket::Ptr socket

Defined in src/symple/include/icy/symple/server.h:144

Optional pre-created listen socket (e.g. SSLSocket for HTTPS/WSS).


{#authentication}

authentication

bool authentication = false

Defined in src/symple/include/icy/symple/server.h:145

Require token in auth message.


{#dynamicrooms}

dynamicRooms

bool dynamicRooms = true

Defined in src/symple/include/icy/symple/server.h:146

Allow clients to join/leave rooms.


{#maxconnections}

maxConnections

size_t maxConnections = 0

Defined in src/symple/include/icy/symple/server.h:149

Max WebSocket connections (0 = unlimited).


{#maxmessagesize}

maxMessageSize

size_t maxMessageSize = 64 * 1024

Defined in src/symple/include/icy/symple/server.h:150

Max message payload in bytes (64KB default).


{#ratelimit}

rateLimit

double rateLimit = 100.0

Defined in src/symple/include/icy/symple/server.h:151

Messages per rate window.


{#rateseconds}

rateSeconds

double rateSeconds = 10.0

Defined in src/symple/include/icy/symple/server.h:152

Rate window in seconds.

{#virtualpeer}

VirtualPeer

#include <src/symple/src/server/detail.h>
struct VirtualPeer

Defined in src/symple/src/server/detail.h:19

List of all members

NameKindOwner
peervariableDeclared here
roomsvariableDeclared here
handlervariableDeclared here

Public Attributes

ReturnNameDescription
Peerpeer
std::unordered_set< std::string >rooms
std::function< void(const json::Value &)>handler

{#peer-5}

peer

Peer peer

Defined in src/symple/src/server/detail.h:21


{#rooms-1}

rooms

std::unordered_set< std::string > rooms

Defined in src/symple/src/server/detail.h:22


{#handler}

handler

std::function< void(const json::Value &)> handler

Defined in src/symple/src/server/detail.h:23

{#routingpolicy}

RoutingPolicy

#include <src/symple/src/server/detail.h>
struct RoutingPolicy

Defined in src/symple/src/server/detail.h:78

List of all members

NameKindOwner
sharesAnyRoomfunctionDeclared here
canDirectMessagefunctionDeclared here
canDirectMessagefunctionDeclared here
canBroadcastToRoomfunctionDeclared here

Public Static Methods

ReturnNameDescription
boolsharesAnyRoom static nodiscard
boolcanDirectMessage static nodiscard
boolcanDirectMessage static nodiscard
boolcanBroadcastToRoom static nodiscard

{#sharesanyroom}

sharesAnyRoom

static nodiscard

[[nodiscard]] static bool sharesAnyRoom(const std::unordered_set< std::string > & a, const std::unordered_set< std::string > & b)

Defined in src/symple/src/server/detail.h:80


{#candirectmessage}

canDirectMessage

static nodiscard

[[nodiscard]] static bool canDirectMessage(const ServerPeer & sender, const ServerPeer & recipient)

Defined in src/symple/src/server/detail.h:82


{#candirectmessage-1}

canDirectMessage

static nodiscard

[[nodiscard]] static bool canDirectMessage(const ServerPeer & sender, const VirtualPeer & recipient)

Defined in src/symple/src/server/detail.h:84


{#canbroadcasttoroom}

canBroadcastToRoom

static nodiscard

[[nodiscard]] static bool canBroadcastToRoom(const ServerPeer & sender, const std::string & room)

Defined in src/symple/src/server/detail.h:86

{#serverpeer}

ServerPeer

#include <icy/symple/server.h>
class ServerPeer

Defined in src/symple/include/icy/symple/server.h:43

Per-connection state for a connected Symple peer.

Created by the server after successful authentication. Holds the peer data, room memberships, and a reference to the underlying WebSocket connection for sending.

List of all members

NameKindOwner
ServerPeerfunctionDeclared here
sendfunctionDeclared here
sendSerializedfunctionDeclared here
joinfunctionDeclared here
leavefunctionDeclared here
leaveAllfunctionDeclared here
peerfunctionDeclared here
peerfunctionDeclared here
idfunctionDeclared here
roomsfunctionDeclared here
authenticatedfunctionDeclared here
setAuthenticatedfunctionDeclared here
setPeerfunctionDeclared here
connectionfunctionDeclared here
checkRatefunctionDeclared here
setRateLimitfunctionDeclared here
_connvariableDeclared here
_peervariableDeclared here
_roomsvariableDeclared here
_rateLimitervariableDeclared here
_authenticatedvariableDeclared here

Public Methods

ReturnNameDescription
ServerPeerConstructs a peer bound to the given server-side connection.
voidsendSerialises and sends a JSON message over the WebSocket connection. Logs a warning if the send fails; does not throw.
voidsendSerializedSends a pre-serialized JSON payload over the WebSocket connection. Use this on fanout paths that already serialized once.
voidjoinAdds this peer to the named room (local tracking only).
voidleaveRemoves this peer from the named room (local tracking only).
voidleaveAllRemoves this peer from all rooms (local tracking only).
Peer &peer inline nodiscardReturns a mutable reference to the peer data object.
const Peer &peer const inline nodiscardReturns a const reference to the peer data object.
std::stringid const nodiscardReturns the session ID assigned to this peer.
const std::unordered_set< std::string > &rooms const inline nodiscardReturns the set of room names this peer is currently joined to.
boolauthenticated const inline nodiscardReturns true if the peer has completed authentication.
voidsetAuthenticated inlineMarks the peer as authenticated or unauthenticated.
voidsetPeer inlineReplaces the peer's data object.
http::ServerConnection &connection inlineReturns a reference to the underlying server connection.
boolcheckRate inline nodiscardPer-peer rate limiter. Returns false if message should be dropped.
voidsetRateLimit inlineConfigures the per-peer rate limit.

{#serverpeer-1}

ServerPeer

ServerPeer(http::ServerConnection & conn)

Defined in src/symple/include/icy/symple/server.h:48

Constructs a peer bound to the given server-side connection.

Parameters

  • conn The underlying WebSocket server connection.

{#send-19}

send

void send(const json::Value & msg)

Defined in src/symple/include/icy/symple/server.h:53

Serialises and sends a JSON message over the WebSocket connection. Logs a warning if the send fails; does not throw.

Parameters

  • msg JSON value to send.

{#sendserialized}

sendSerialized

void sendSerialized(const char * data, size_t len)

Defined in src/symple/include/icy/symple/server.h:57

Sends a pre-serialized JSON payload over the WebSocket connection. Use this on fanout paths that already serialized once.


{#join-1}

join

void join(const std::string & room)

Defined in src/symple/include/icy/symple/server.h:61

Adds this peer to the named room (local tracking only).

Parameters

  • room Room name to join.

{#leave-1}

leave

void leave(const std::string & room)

Defined in src/symple/include/icy/symple/server.h:65

Removes this peer from the named room (local tracking only).

Parameters

  • room Room name to leave.

{#leaveall-1}

leaveAll

void leaveAll()

Defined in src/symple/include/icy/symple/server.h:68

Removes this peer from all rooms (local tracking only).


{#peer-6}

peer

inline nodiscard

[[nodiscard]] inline Peer & peer()

Defined in src/symple/include/icy/symple/server.h:71

Returns a mutable reference to the peer data object.


{#peer-7}

peer

const inline nodiscard

[[nodiscard]] inline const Peer & peer() const

Defined in src/symple/include/icy/symple/server.h:74

Returns a const reference to the peer data object.


{#id-9}

id

const nodiscard

[[nodiscard]] std::string id() const

Defined in src/symple/include/icy/symple/server.h:77

Returns the session ID assigned to this peer.


{#rooms-2}

rooms

const inline nodiscard

[[nodiscard]] inline const std::unordered_set< std::string > & rooms() const

Defined in src/symple/include/icy/symple/server.h:80

Returns the set of room names this peer is currently joined to.


{#authenticated}

authenticated

const inline nodiscard

[[nodiscard]] inline bool authenticated() const

Defined in src/symple/include/icy/symple/server.h:83

Returns true if the peer has completed authentication.


{#setauthenticated}

setAuthenticated

inline

inline void setAuthenticated(bool v)

Defined in src/symple/include/icy/symple/server.h:87

Marks the peer as authenticated or unauthenticated.

Parameters

  • v True to mark as authenticated.

{#setpeer}

setPeer

inline

inline void setPeer(const Peer & p)

Defined in src/symple/include/icy/symple/server.h:91

Replaces the peer's data object.

Parameters

  • p New peer data.

{#connection-10}

connection

inline

inline http::ServerConnection & connection()

Defined in src/symple/include/icy/symple/server.h:94

Returns a reference to the underlying server connection.


{#checkrate}

checkRate

inline nodiscard

[[nodiscard]] inline bool checkRate()

Defined in src/symple/include/icy/symple/server.h:97

Per-peer rate limiter. Returns false if message should be dropped.


{#setratelimit}

setRateLimit

inline

inline void setRateLimit(double rate, double seconds)

Defined in src/symple/include/icy/symple/server.h:102

Configures the per-peer rate limit.

Parameters

  • rate Maximum messages allowed per window.

  • seconds Duration of the rate window in seconds.

Private Attributes

ReturnNameDescription
http::ServerConnection &_conn
Peer_peer
std::unordered_set< std::string >_rooms
RateLimiter_rateLimiter100 messages per 10 seconds default
bool_authenticated

{#_conn}

_conn

http::ServerConnection & _conn

Defined in src/symple/include/icy/symple/server.h:109


{#_peer-1}

_peer

Peer _peer

Defined in src/symple/include/icy/symple/server.h:110


{#_rooms-1}

_rooms

std::unordered_set< std::string > _rooms

Defined in src/symple/include/icy/symple/server.h:111


{#_ratelimiter}

_rateLimiter

RateLimiter _rateLimiter {100.0, 10.0}

Defined in src/symple/include/icy/symple/server.h:112

100 messages per 10 seconds default


{#_authenticated}

_authenticated

bool _authenticated = false

Defined in src/symple/include/icy/symple/server.h:113

{#address-13}

Address

#include <icy/symple/address.h>
struct Address

Defined in src/symple/include/icy/symple/address.h:28

The Address structure is an endpoint identifier for a peer on the network. The format is like so: user|id

List of all members

NameKindOwner
operator<<friendDeclared here
uservariableDeclared here
idvariableDeclared here
AddressfunctionDeclared here
AddressfunctionDeclared here
AddressfunctionDeclared here
parsefunctionDeclared here
validfunctionDeclared here
printfunctionDeclared here
toStringfunctionDeclared here
operator==functionDeclared here
operator==functionDeclared here

Friends

NameDescription
operator<< inline

{#operator-34}

operator<<

inline

friend inline std::ostream & operator<<(std::ostream & os, const Address & addr)

Defined in src/symple/include/icy/symple/address.h:71

Public Attributes

ReturnNameDescription
std::stringuser
std::stringid

{#user}

user

std::string user

Defined in src/symple/include/icy/symple/address.h:77


{#id-5}

id

std::string id

Defined in src/symple/include/icy/symple/address.h:79

Public Methods

ReturnNameDescription
AddressConstructs an empty (invalid) address.
AddressParses an address string of the form user|id.
AddressConstructs an address from explicit user and session ID components.
boolparseParses an address string of the form user|id. Populates the [user](#user) and [id](#id-5) fields.
boolvalid const nodiscardReturns true if at least one of [user](#user) or [id](#id-5) is non-empty.
voidprint constWrites the address in user|id format to the given stream.
std::stringtoString const nodiscardReturns the address as a string in user|id format.
booloperator== constCompares two addresses for equality (both user and id must match).
booloperator== constCompares this address against a string in user|id format without allocating.

{#address-14}

Address

Address()

Defined in src/symple/include/icy/symple/address.h:32

Constructs an empty (invalid) address.


{#address-15}

Address

Address(std::string_view addr)

Defined in src/symple/include/icy/symple/address.h:36

Parses an address string of the form user|id.

Parameters


{#address-16}

Address

Address(const std::string & user, const std::string & id)

Defined in src/symple/include/icy/symple/address.h:41

Constructs an address from explicit user and session ID components.

Parameters

  • user User identifier.

  • id Session ID.


{#parse-2}

parse

bool parse(std::string_view addr)

Defined in src/symple/include/icy/symple/address.h:50

Parses an address string of the form user|id. Populates the [user](#user) and [id](#id-5) fields.

Parameters

Returns

True if the result is a valid address.


{#valid-10}

valid

const nodiscard

[[nodiscard]] bool valid() const

Defined in src/symple/include/icy/symple/address.h:53

Returns true if at least one of [user](#user) or [id](#id-5) is non-empty.


{#print-15}

const

void print(std::ostream & os) const

Defined in src/symple/include/icy/symple/address.h:57

Writes the address in user|id format to the given stream.

Parameters

  • os Output stream.

{#tostring-9}

toString

const nodiscard

[[nodiscard]] std::string toString() const

Defined in src/symple/include/icy/symple/address.h:61

Returns the address as a string in user|id format.

Returns

Serialised address string.


{#operator-35}

operator==

const

bool operator==(const Address & r) const

Defined in src/symple/include/icy/symple/address.h:65

Compares two addresses for equality (both user and id must match).

Parameters


{#operator-36}

operator==

const

bool operator==(const std::string & r) const

Defined in src/symple/include/icy/symple/address.h:69

Compares this address against a string in user|id format without allocating.

Parameters

  • r String to compare against.

{#clientstate-1}

ClientState

#include <icy/symple/client.h>
struct ClientState

Defined in src/symple/include/icy/symple/client.h:38

Inherits: State

Client connection states.

List of all members

NameKindOwner
strfunctionDeclared here
TypeenumDeclared here
IDtypedefInherited from State
_idvariableInherited from State
StatefunctionInherited from State
StatefunctionInherited from State
operator=functionInherited from State
~StatefunctionInherited from State
idfunctionInherited from State
setfunctionInherited from State
strfunctionInherited from State
toStringfunctionInherited from State
equalsfunctionInherited from State
betweenfunctionInherited from State
operator==functionInherited from State
operator==functionInherited from State
operator<<friendInherited from State

Inherited from State

KindNameDescription
typedefID
variable_id
functionState
functionStateCopy constructor.
functionoperator=Copy assignment.
function~State virtualDefaulted destructor.
functionid constReturns the current state ID.
functionsetSets the state ID.
functionstr virtual constReturns a human-readable string for the given state ID. Override in derived classes to provide meaningful names.
functiontoString virtual constReturns a human-readable string for the current state ID.
functionequals constReturns true if the current state ID equals the given ID.
functionbetween constReturns true if the current state ID is in the inclusive range [lid, rid].
functionoperator== const inline
functionoperator== const inline
friendoperator<< inline

Public Methods

ReturnNameDescription
std::stringstr const inline override

{#str-3}

str

const inline override

inline std::string str(unsigned int id) const override

Defined in src/symple/include/icy/symple/client.h:49

Public Types

NameDescription
Type

{#type-20}

Type

enum Type

Defined in src/symple/include/icy/symple/client.h:40

ValueDescription
Closed
Connecting
Authenticating
Online
Error