title: How to publish a message from Firebase Functions V2 PubSub?
body: <p>The <a href="https://firebase.google.com/docs/functions/beta/pubsub-events" rel="nofollow noreferrer">docs for firebase functions v2</a>  includes information on how to listen to published messages however it doesn't show how to publish messages.</p>
  <pre><code>exports.hellopubsub = onMessagePublished(&quot;topic-name&quot;, (event) =&gt; {
    // ...
  });
  </code></pre>
  <p>How do you publish messages from v2 pubsub functions without starting a separate nodejs server?</p>