From d296ccd7929a0cd3c7607a64e81128ad6e037da2 Mon Sep 17 00:00:00 2001 From: Sebastix Date: Sun, 24 Nov 2024 23:05:56 +0100 Subject: [PATCH] update readme with subscription adjustments --- README.md | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 190e186..57dd6f9 100644 --- a/README.md +++ b/README.md @@ -116,15 +116,13 @@ $result = $relay->send(); Fetch events from a relay. ```php -$subscription = new Subscription(); -$subscriptionId = $subscription->setId(); - $filter1 = new Filter(); $filter1->setKinds([1, 3]); // You can add multiple kind numbers $filter1->setLimit(25); // Limit to fetch only a maximum of 25 events $filters = [$filter1]; // You can add multiple filters. -$requestMessage = new RequestMessage($subscriptionId, $filters); +$subscription = new Subscription(); +$requestMessage = new RequestMessage($subscription->getid(), $filters); $relayUrl = 'wss://nostr-websocket.tld'; $relay = new Relay($relayUrl); @@ -182,14 +180,12 @@ Read events from a set of relays with the `RelaySet` class. It's basically the same snippet as above with the difference you create a `RelaySet` class and pass it through the `Request` object. ```php -$subscription = new Subscription(); -$subscriptionId = $subscription->setId(); - $filter1 = new Filter(); $filter1->setKinds([1]); $filter1->setLimit(5); $filters = [$filter1]; -$requestMessage = new RequestMessage($subscriptionId, $filters); +$subscription = new Subscription(); +$requestMessage = new RequestMessage($subscription->getId(), $filters); $relays = [ new Relay('wss://nostr-websocket-1.tld'), new Relay('wss://nostr-websocket-2.tld'),