-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught error when writing to nostr.wine #77
Comments
https://github.com/nostrver-se/nostr-php/releases/tag/1.5.3 A Pong message is now send back to the relay when a Ping message was received. I think that's the problem that was needed to be fixed. I also added this snippet <?php
declare(strict_types=1);
require __DIR__ . '/../../vendor/autoload.php';
use swentel\nostr\Event\Event;
use swentel\nostr\Key\Key;
use swentel\nostr\Message\EventMessage;
use swentel\nostr\Relay\Relay;
use swentel\nostr\RelayResponse\RelayResponse;
use swentel\nostr\RelayResponse\RelayResponseOk;
use swentel\nostr\Request\Request;
use swentel\nostr\Sign\Sign;
try {
$note = new Event();
$note->setKind(1);
$note->addTag(['t', 'introduction']);
$note->addTag(['r', 'wss://nostr.wine']);
$content = 'Hello Nostr world! This is just a test, please ignore.';
$note->setContent($content);
// Sign event.
$private_key = new Key();
$private_key = $private_key->generatePrivateKey();
$signer = new Sign();
$signer->signEvent($note, $private_key);
// Optional, verify event.
$isValid = $note->verify();
// Transmit the event to a relay.
$relay = new Relay('wss://nostr.wine');
$eventMessage = new EventMessage($note);
$relay->setMessage($eventMessage);
$request = new Request($relay, $eventMessage);
$response = $request->send();
// Handle response.
foreach ($response as $relayUrl => $relayResponses) {
foreach ($relayResponses as $relayResponse) {
if ($relayResponse->isSuccess && $relayResponse instanceof RelayResponseOk) {
print 'The event has been transmitted to the relay ' . $relayUrl . PHP_EOL;
$eventId = $relayResponse->eventId;
print 'The received event id from the relay: ' . $relayResponse->eventId;
// Now we could request the event with this id.
}
}
}
} catch (Exception $e) {
print 'Exception error: ' . $e->getMessage() . PHP_EOL;
} @SilberWitch please let me know if this is solving your issue :) |
Sorry, that I didn't reply sooner. I now just get "Connection error" as a response. |
Also with the example snippet provided in the library? |
I'm sorry, but which snippet do you mean? |
|
No, I now get It might be a problem with my DNS, tho. We're going to install a new router and then I'll try again. |
Still doesn't work. See PR. |
This will be solved in a next release of the |
Hi, I was testing writing 30040 events to various relays, and it worked everywhere except nostr.wine. Mazin says that the kind isn't blocked, and my user has wine access.
When I look at what it's doing, it receives the ping and apparently no ERROR, but it must be getting something wrong back. Could you test it out, for me, with your own npub? Is it something with the AUTH?
PHP Warning: Undefined variable $result in /home/ohji/Projects/eBookUtility/vendor/swentel/nostr-php/src/Relay/RelaySet.php on line 143
The text was updated successfully, but these errors were encountered: