close

fun close(code: Short = definedExternally, reason: String = definedExternally)(source)

Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.

MDN Reference