close

suspend fun WebSocketSession.close(reason: CloseReason): Unit

Send a close frame with the specified reason. May suspend if outgoing channel is full or may throw an exception if it is already closed. The specified reason could be ignored if there was already close frame sent (for example in reply to a peer close frame).