title: How do I subscribe to a NATS subject in Python and keep receiving messages?
body: <p>I tried out the example below (from <a href="https://docs.nats.io/developing-with-nats/receiving/async" rel="nofollow noreferrer">this</a> page):</p>
  <pre class="lang-py prettyprint-override"><code>nc = NATS()
  
  await nc.connect(servers=[&quot;nats://demo.nats.io:4222&quot;])
  
  future = asyncio.Future()
  
  async def cb(msg):
    nonlocal future
    future.set_result(msg)
  
  await nc.subscribe(&quot;updates&quot;, cb=cb)
  await nc.publish(&quot;updates&quot;, b'All is Well')
  await nc.flush()
  
  # Wait for message to come in
  msg = await asyncio.wait_for(future, 1)
  </code></pre>
  <p>But this only seems useful for receiving one message.  How would I subscribe and keep receiving messages?</p>
  <p>I've also seen <a href="https://github.com/nats-io/nats.py#basic-usage" rel="nofollow noreferrer">the package example</a>, but it seems to just play both sides of the conversation, then quit.</p>