|
Slick Sim 0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
|
One fan-out payload, serialised once and stamped per subscriber. More...
#include <market_data_publisher/sequenced_message.hpp>
Public Member Functions | |
| SequencedMessage (nlohmann::json &message) | |
| std::string_view | render (uint64_t sequence_num) |
| The payload for one subscriber. | |
One fan-out payload, serialised once and stamped per subscriber.
Coinbase gives every subscriber its own sequence_num, so a market-data message differs between them by a single integer - but nlohmann has to walk the whole document to produce the text, so dumping inside the per-socket loop re-serialises an identical body once per subscriber. Measured on a ten-level l2_data update with 50 subscribers, dumping once and splicing the number in is ~47x faster.
Hyperliquid does not sequence per subscriber and already sends one shared payload to every socket, so this is only needed on the Coinbase side.
Construction rewrites sequence_num in the document, so the json passed in is consumed - build the message, then wrap it, then fan out.
Definition at line 24 of file sequenced_message.hpp.
|
inlineexplicit |
Definition at line 26 of file sequenced_message.hpp.
|
inline |
The payload for one subscriber.
The returned view is valid until the next call on this object, which is all ws->send() needs.
Definition at line 50 of file sequenced_message.hpp.