API reference#
Everything delivery_module exposes, generated from the doc comments in
src/delivery_module_plugin.h: the methods you call, and the events they
report back through.
Methods#
Every call returns as soon as its request is dispatched. Where the outcome only becomes known later, it is reported through the events below.
-
StdLogosResult createNode(const std::string &cfg)#
Creates a liblogosdelivery node from a JSON configuration.
The JSON passes through to logos-delivery verbatim;
parseLogosDeliveryConf(logos-messaging/logos-delivery) owns the grammar.entryLayerselects how much of the stack is mounted:"kernel"— transport node only"messaging"— kernel + messaging client"channels"— kernel + messaging + reliable channels (default)
Three typical shapes:
App developer — full stack (default
entryLayer).presetpicks the network ("logos.test","logos.dev","twn"),modepicks the protocol flags ("Core"= relay node,"Edge"= light node). OptionalmessagingOverrides/channelsOverridesobjects override per-layer defaults:{ "mode": "Core", "preset": "logos.test" }
Node operator — kernel-only service node on a public network.
modeis not applied on this layer, so protocol flags are set explicitly inkernelConf:{ "entryLayer": "kernel", "kernelConf": { "preset": "logos.test", "relay": true } }
Network hoster — kernel-only node on a self-hosted network;
kernelConfis a rawWakuNodeConfused as-is:{ "entryLayer": "kernel", "kernelConf": { "clusterId": 42, "relay": true, "entryNodes": ["/dns4/…"] } }
On kernel-only nodes
send/subscribe/channel*fail with “node has
no messaging client” / “no reliable channel manager”;
getNodeInfo,storeQueryand metrics keep working.The pre-layered flat shape (bare
WakuNodeConfkeys at top level) still parses and boots the full stack.- Parameters:
cfg – UTF-8 JSON payload string.
- Returns:
trueif context creation succeeds and callback returnsRET_OK, otherwisefalse.
-
StdLogosResult start()#
Starts the delivery node.
- Returns:
trueonce dispatched; completion is reported vianodeStarted.
-
StdLogosResult stop()#
Stops the delivery node.
- Returns:
trueonce dispatched; completion is reported vianodeStopped.
-
StdLogosResult send(const std::string &contentTopic, const std::vector<uint8_t> &payload)#
Sends a message over the active node.
Builds a JSON envelope expected by
logosdelivery_send:{ "contentTopic": string, "payload": base64, "ephemeral": false }.Returns a requestId on success. Async results come via typed events:
messageErroremitted if the module can’t send the messagemessagePropagatedemitted if the message has hit the networkmessageSentemitted after the message is validated by the network
- Parameters:
contentTopic – Destination content topic.
payload – Raw message bytes; base64-encoded before crossing the FFI boundary.
- Returns:
Success with request id, or error details.
-
StdLogosResult subscribe(const std::string &contentTopic)#
Subscribes to the supplied content topic.
- Parameters:
contentTopic – Topic identifier.
- Returns:
truewhen subscribed successfully, otherwisefalse.
-
StdLogosResult unsubscribe(const std::string &contentTopic)#
Unsubscribes from the supplied content topic.
- Parameters:
contentTopic – Topic identifier.
- Returns:
truewhen unsubscribed successfully, otherwisefalse.
-
StdLogosResult storeQuery(const std::string &jsonQuery, const std::string &peerAddr, int64_t timeoutMs)#
Runs a Store (historical message) query against a specific store service peer.
⚠️ USE AT YOUR OWN RISK: backed by the kernel API (
waku_store_query,liblogosdelivery_kernel.h), which is subject to change at any point without a deprecation cycle. This method’s JSON contract follows it.The query JSON maps to logos-delivery’s
StoreQueryRequest(library/kernel_api/protocols/store_api.nim):Key
Type
Required
Description
requestIdstring
yes
Caller-chosen id, echoed in the response
includeDataboolean
yes
truereturns full messages,falsehashes onlypaginationForwardboolean
yes
Paging direction
pubsubTopicstring
no
Pubsub topic filter
contentTopicsarray of string
no
Content topic filters
timeStartnumber/string
no
Range start, nanoseconds since Unix epoch
timeEndnumber/string
no
Range end, nanoseconds since Unix epoch
messageHashesarray of string
no
Hex message hashes for lookup-by-hash queries
paginationCursorstring
no
Hex cursor from a previous response
paginationLimitnumber
no
Max messages per page
On success the result value is the response JSON (
StoreQueryResponseHex):{ "requestId", "statusCode", "statusDesc", "messages": [ { "messageHash", "message", "pubsubTopic" } ], "paginationCursor" }with hashes 0x-hex encoded.- Parameters:
jsonQuery – UTF-8 JSON query document, see above.
peerAddr – Multiaddress of the store service peer to query (e.g.
/ip4/127.0.0.1/tcp/60000/p2p/16Uiu2...).timeoutMs – Query timeout in milliseconds.
- Returns:
Success with the response JSON, or error details.
-
StdLogosResult channelCreate(const std::string &channelId, const std::string &contentTopic, const std::string &senderId)#
Creates (or re-opens) a reliable channel.
Persisted channel state survives channelClose, so re-creating a channel with the same id restores it.
- Parameters:
channelId – Application-chosen channel identifier.
contentTopic – Content topic the channel communicates on.
senderId – This participant’s SDS (Scalable Data Sync) sender identifier.
- Returns:
Success with the channel id, or error details.
-
StdLogosResult channelExists(const std::string &channelId)#
Checks whether a reliable channel is currently open.
An unknown channel id is not an error.
- Parameters:
channelId – Channel identifier.
- Returns:
Success with
"true"or"false"(verbatim FFI string), or error details.
-
StdLogosResult channelSend(const std::string &channelId, const std::vector<uint8_t> &payload)#
Sends a message on a reliable channel.
Builds the JSON envelope expected by
logosdelivery_channel_send:{ "payload": base64, "ephemeral": false }.Returns a requestId on success. Async results come via typed events:
channelMessageSentonce every segment of the send is confirmedchannelMessageErrorif the send finalises with a failed segment
- Parameters:
channelId – Channel identifier.
payload – Raw message bytes; base64-encoded before crossing the FFI boundary.
- Returns:
Success with request id, or error details.
-
StdLogosResult channelClose(const std::string &channelId)#
Closes a reliable channel: stops its SDS loops.
Persisted state survives, so channelCreate with the same id restores the channel.
- Parameters:
channelId – Channel identifier.
- Returns:
truewhen closed successfully, otherwisefalse.
-
StdLogosResult getAvailableNodeInfoIDs()#
Lists the node info items this node advertises, for use with getNodeInfo.
The list comes back as a JSON array of strings:
["Version", "Metrics", "MyMultiaddresses", "MyENR", "MyPeerId"]
Which items a node advertises depends on how it was built and configured, so treat the set as discovered rather than fixed. An advertised item may still return an empty value from getNodeInfo when the feature behind it is unconfigured.
- Returns:
Success with the list above, or error details. Fails before createNode has run.
-
StdLogosResult getNodeInfo(const std::string &nodeInfoId)#
Returns information for the given node info item.
- Parameters:
nodeInfoId – Identifier for the requested node info item.
- Returns:
JSON data string on success, or error details.
-
StdLogosResult getAvailableConfigs()#
Information about the available configuration parameters for
createNode.
-
std::string collectOpenMetricsText()#
Returns the node’s metrics as an OpenMetrics/Prometheus text document, so the
openmetricsmodule can scrape this module.liblogosdelivery already aggregates Prometheus metrics in its global registry and renders them as exposition text behind the
"Metrics"node-info attribute. This method just hands that text back verbatim — no reshaping — which satisfies the openmetricsmetrics_sourceinterface’scollectOpenMetricsText()convention. The openmetrics scraper parses the text, injects amodule="delivery_module"label on every series, and merges it with other modules. Select this method per-module in the openmetricsstartconfig with{"name":"delivery_module","format":"text"}.Returns an empty string before a node has been created, or when the underlying read fails, so a scrape never errors out on this module.
- Returns:
OpenMetrics/Prometheus exposition text (possibly empty).
Events#
A caller never invokes these. Every method above returns as soon as its request is dispatched, and what actually happened on the network arrives here — so subscribe to these rather than reading a return value.
send and channelSend return a request id, and every event reporting the
outcome of that call carries the same id, so several messages can be in flight
at once.
Timestamps are int64 nanoseconds since the Unix epoch. messageReceived
reports the timestamp carried by the message itself; every other event is
stamped by the module host when the event is emitted.
-
void messageSent(const std::string &requestId, const std::string &messageHash, int64_t timestamp)#
Emitted when the network has validated a sent message.
The success terminal state for send, usually preceded by messagePropagated.
-
void messageError(const std::string &requestId, const std::string &messageHash, const std::string &error, int64_t timestamp)#
Emitted when the module could not send a message;
errorcarries the reason.
-
void messagePropagated(const std::string &requestId, const std::string &messageHash, int64_t timestamp)#
Emitted when a message has reached the network but is not yet validated.
-
void messageReceived(const std::string &messageHash, const std::string &contentTopic, const std::vector<uint8_t> &payload, int64_t timestamp)#
Emitted when a message arrives on a subscribed content topic.
payloadis delivered as raw bytes, already decoded from the wire encoding.
-
void connectionStateChanged(const std::string &connectionStatus, int64_t timestamp)#
Emitted when the node’s connectivity changes.
-
void channelMessageReceived(const std::string &channelId, const std::string &senderId, const std::vector<uint8_t> &payload, int64_t timestamp)#
Emitted when a message arrives on an open reliable channel.
senderIdis the sending participant’s SDS identifier.payloadis delivered as raw bytes, already decoded from the wire encoding.
-
void channelMessageSent(const std::string &channelId, const std::string &requestId, int64_t timestamp)#
Emitted once every segment of a channelSend is confirmed.
-
void channelMessageError(const std::string &channelId, const std::string &requestId, const std::string &error, int64_t timestamp)#
Emitted when a channelSend finalises with a failed segment.