aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/nostr.hpp5
-rw-r--r--src/filters.cpp4
2 files changed, 7 insertions, 2 deletions
diff --git a/include/nostr.hpp b/include/nostr.hpp
index fa407ef..8041efe 100644
--- a/include/nostr.hpp
+++ b/include/nostr.hpp
@@ -83,10 +83,13 @@ struct Filters
/**
* @brief Serializes the filters to a JSON object.
+ * @param subscriptionId A string up to 64 chars in length that is unique per relay connection.
* @returns A stringified JSON object representing the filters.
* @throws `std::invalid_argument` if the filter object is invalid.
+ * @remarks The Nostr client is responsible for managing subscription IDs. Responses from the
+ * relay will be organized by subscription ID.
*/
- std::string serialize();
+ std::string serialize(std::string subscriptionId);
private:
/**
diff --git a/src/filters.cpp b/src/filters.cpp
index 0735a19..3179c2f 100644
--- a/src/filters.cpp
+++ b/src/filters.cpp
@@ -13,7 +13,7 @@ using std::time;
namespace nostr
{
-string Filters::serialize()
+string Filters::serialize(string subscriptionId)
{
try
{
@@ -42,6 +42,8 @@ string Filters::serialize()
j[tagname] = tag.second;
}
+ json jarr = json::array({ "REQ", subscriptionId, j });
+
return j.dump();
};