Skip to content

Commit

Permalink
update readme with subscription adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastix committed Nov 24, 2024
1 parent 115784b commit d296ccd
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit d296ccd

Please sign in to comment.