Example #1
0
        /// <summary>
        /// Closes the connection to the client gracefully.
        /// </summary>
        public async Task CloseConnection(Message lastMessage)
        {
            if (!Connected)
            {
                return;
            }

            // Tell the client that we're shutting down
            await Send(lastMessage);

            await connection.Close(WebsocketCloseReason.Normal, "Goodbye!");
        }
 private void OnApplicationQuit()
 {
     ws?.Close();
 }