e" title="View on GitHub"></i></a><a class="toolbar-icons pull-right"><i class="mdi mdi-content-copy js-copy" title="Copy to Clipboard"></i></a><span class="copy-msg pull-right"></span><code class="language-java">Connection nc = Nats.connect(&#34;nats://demo.nats.io:4222&#34;);

nc.publish(&#34;updates&#34;, &#34;All is Well&#34;.getBytes(StandardCharsets.UTF_8));

// Make sure the message goes through before we close
nc.flush(Duration.ZERO);
nc.close();
</code></pre>
	</div>
	
	<div class="tab__content">
	