onDisconnected

abstract var onDisconnected: (Boolean) -> Unit

Called when the websocket disconnects. The lambda parameter indicates, whether the connection was closed on demand by user, or by some external factors, like connection problems. You might want to use this for auto-reconnect logic, if the connection was closed unexpectedly.