Closed pjv closed 11 months ago
I have also an exception: Without try catch $result = $relay->send();
is not working. With try catch it works, posts the "Hello world" String to the relay - but with an exception "Empty read; connection dead?"
What I am doing wrong?
It seems that it's not needed to close the connection in the function send()
: After commenting $client->close();
it works fine with no exception. Is the connection closing automatically?
Interesting .. it looks like adding a try/catch in the library makes sense. But I'd throw our own exception then would make sense in a way I think. Let me think about it some more.
(note: I'm on holiday until the 17th, so a bit slow at the moment)
@georgkaser Is this an issue for you? A small change is just made on how the connection to a relay is closed: https://github.com/swentel/nostr-php/pull/46
I’m building a wordpress plugin and ran across this fatal error when a relay sent a 503 connection error.
I’ll try to add a
try… catch
in my code to work around this, but I’m posting this here in case you think it would be useful to catch errors like this at the library level. It seems to me that would be better.