diff --git a/src/Application/Client.php b/src/Application/Client.php index c5ad8e2..ccc7b04 100644 --- a/src/Application/Client.php +++ b/src/Application/Client.php @@ -93,6 +93,6 @@ public function run($args): void protected function showHelp($message): void { print "\n[error] " . $message . "\n\nUsage:\n"; - print "nostr-php --content \"Hello world!\" --key /home/path/to/nostr-private.key --relay wss://nostr.pleb.network\n\n"; + print "bin/nostr-php --content \"Hello world!\" --key /home/path/to/nostr-private.key --relay wss://nostr.pleb.network\n\n"; } } diff --git a/src/Relay/Relay.php b/src/Relay/Relay.php index 93ebe9a..74fa7c0 100644 --- a/src/Relay/Relay.php +++ b/src/Relay/Relay.php @@ -38,9 +38,13 @@ class Relay implements RelayInterface * @param string $websocket * The socket URL. */ - public function __construct(string $websocket) + public function __construct(string $websocket, MessageInterface $message = null) { $this->url = $websocket; + // Backwards compatibility for version <1.2.4 + if ($message !== null) { + $this->setMessage($message); + } } /** @@ -87,7 +91,7 @@ public function send(): CommandResultInterface $client->text($this->payload); $response = $client->receive(); $client->disconnect(); - $response = json_decode($response); + $response = json_decode($response->getContent()); if ($response[0] === 'NOTICE') { throw new \RuntimeException($response[1]); }