Note! Semantics have changed with version 3.0 due to name clash with AutoCloseable! The 2.x version of close() has been renamed to connectionClose().

This function releases any resources associated with the Connection instance. This method is called automatically at the end of a try-with-resources block, which helps to ensure that resources are released promptly and reliably.

Example of using a CoAP object within a try-with-resources statement:

try (Connection connection = client.createConnect(...)) {
// ... use connection

With this setup, {@code close()} will be called automatically on {@code connect} at the end of the block, releasing any underlying native Nabto Client SDK resources without any further action required on the application.

If the try-with-resources construct is not feasible, the application must manually call close() when the Connection instance is no longer needed.</p>

Unlike the {@link AutoCloseable#close()} method, this {@code close()} method does not throw any exceptions.


    void close()