Exemplo n.º 1
0
        private void ProcessReceivedResponse(GSObject response, GSConnection connection)
        {
            String    requestId = response.GetString("requestId");
            GSRequest request   = connection.GetAndRemovePending(requestId);

            if (request == null)
            {
                return;
            }

            if (request.RequestExpiresAt > 0)
            {
                //It's durable request, if it's a ClientError do nothing as it will be retried
                if (response.ContainsKey("@class") && !response.GetString("@class").Equals("ClientError"))
                {
                    _durableQueueDirty = _persistantQueue.Remove(request);

                    request.Complete(this, response);
                }
            }
            else
            {
                request.Complete(this, response);
            }
        }
Exemplo n.º 2
0
        private void CancelRequest(GSRequest request)
        {
            if (request.Durable)
            {
                return;
            }

            GSObject error = new GSObject("ClientError");

            error.AddObject("error", new GSRequestData().AddString("error", "timeout"));
            error.AddString("requestId", request.GetString("requestId"));

            GSPlatform.ExecuteOnMainThread(() =>
            {
                try
                {
                    request.Complete(this, error);
                }
                catch (Exception e)
                {
                    GSPlatform.DebugMsg(e.ToString());
                }
            });
        }