Nats\Connection::publish PHP Method

publish() public method

Publish publishes the data argument to the given subject.
public publish ( string $subject, string $payload = null ) : void
$subject string Message topic.
$payload string Message data.
return void
    public function publish($subject, $payload = null)
    {
        $msg = 'PUB ' . $subject . ' ' . strlen($payload);
        $this->send($msg . "\r\n" . $payload);
        $this->pubs += 1;
    }