ait connect({
    maxReconnectAttempts: 10,
    servers: [&#34;nats://demo.nats.io:4222&#34;]
});
// first argument is the connection (same as nc in this case)
// second argument is the url of the server where the client
// connected
nc.on(&#39;reconnect&#39;, (conn, server) =&gt; {
    console.log(&#39;reconnected to&#39;, server);
});
nc.close();
</code></pre>
	</div>
	
</div>
