connect_verbose.py 368 B

12345678910111213141516171819
  1. import asyncio
  2. from nats.aio.client import Client as NATS
  3. async def example():
  4. # [begin connect_verbose]
  5. nc = NATS()
  6. await nc.connect(servers=["nats://demo.nats.io:4222"], verbose=True)
  7. # Do something with the connection.
  8. # [end connect_verbose]
  9. await nc.close()
  10. loop = asyncio.get_event_loop()
  11. loop.run_until_complete(example())
  12. loop.close()