Example #1
0
        internal WebSocketHandlerProxy(Stream stream, WebSocketCommunicationHandler handler, ComposableHandler websocketHandler)
        {
            this._networkStream    = stream;
            this._handler          = handler;
            this._websocketHandler = websocketHandler;

            CurrentProxy = this;
            HandleConnection();
        }
Example #2
0
        internal void CallOnMessage(string message, WebSocketHandlerProxy proxy)
        {
            int tries = 0;

RETRY:

            try
            {
                OnMessage(message, proxy);
            }
            catch (MutexRetryException e)
            {
                if (tries > 10)
                {
                    throw e;
                }

                Logger.LogTrace("MutexRetryException in Websocket - retrying...");

                tries++;
                Thread.Sleep(_random.Next(5 * tries));
                goto RETRY;
            }
        }
Example #3
0
 internal void CallOnDisconnect(WebSocketHandlerProxy webSocketHandlerProxy)
 {
     OnDisconnect(webSocketHandlerProxy);
 }