close

abstract fun close(code: Int, reason: String)

If the websocket is connected, attempts to close the websocket gracefully and asynchronously by sending a close frame with code and reason. In all cases, release its resources.

After this call, no more calls to the listener are made

Note: there is no API to retrieve the server close code because Apple cancelWithCloseCode calls the URLSession delegate with the same (client) code.