예제 #1
0
 protected virtual void OnReciveTextPacket(WebSocketProtocol aSender, IWebSocketPacket e)
 {
     if (recivePacket != null)
     {
         recivePacket(aSender, e);
     }
 }
예제 #2
0
        protected override void OnReciveTextPacket(WebSocketProtocol aSender, IWebSocketPacket e)
        {
            if (recivePacket != null)
                recivePacket(aSender, e);
            try
            {
                JsonObject lTextjson = new JsonObject(e.GetString());

                IToken lToken = PacketToToken(e);
                string lType = lToken.GetType();

                lock (PendingResponseQueue)
                {
                    if (!lType.Equals(WebSocketMessage.WELCOME) && !lType.Equals(WebSocketMessage.GOODBYTE))
                    {
                        try
                        {
                            int lUTID = lToken.GetInt(WebSocketMessage.UTID);
                            int lCode = lToken.GetInt(WebSocketMessage.CODE);

                            PendingResponseQueue lPRQI = PendingResponseQueue[lUTID];
                            if (lPRQI != null)
                            {
                                bool lSuccess = false;
                                if (lCode == 0)
                                    lSuccess = true;

                                TokenResponse lResponse = new TokenResponse(mPendingResponseQueue[lUTID].Token, lToken, lSuccess);
                                lPRQI.PendingResponse.Invoke(this, lResponse);
                                PendingResponseQueue.Remove(lUTID);
                            }
                        }
                        catch (Exception) { }
                    }
                }
                OnReciveTokenText(lToken);
            }
            catch (Exception) { }
        }
예제 #3
0
 protected virtual void OnReciveTextPacket(WebSocketProtocol aSender, IWebSocketPacket e)
 {
     if (recivePacket != null)
     {
         recivePacket(aSender, e);
     }
 }