max_payload.py 405 B

123456789101112131415161718192021
  1. import asyncio
  2. from nats.aio.client import Client as NATS
  3. async def example():
  4. # [begin max_payload]
  5. nc = NATS()
  6. await nc.connect(servers=["nats://demo.nats.io:4222"])
  7. print("Maximum payload is %d bytes" % nc.max_payload)
  8. # Do something with the max payload.
  9. # [end max_payload]
  10. await nc.close()
  11. loop = asyncio.get_event_loop()
  12. loop.run_until_complete(example())
  13. loop.close()