Esempio n. 1
0
        private void SendKeepAliveMessage()
        {
            // do nothing if we have disposed or disconnected
            if (Session == null)
            {
                return;
            }

            // do not send multiple keep-alive messages concurrently
            if (Monitor.TryEnter(_keepAliveLock))
            {
                try
                {
                    Session.TrySendMessage(new IgnoreMessage());
                }
                finally
                {
                    Monitor.Exit(_keepAliveLock);
                }
            }
        }