public void GetUpdates(string serverName, string key, long ts, Action <BackendResult <UpdatesResponse, LongPollResultCode> > callback) { JsonWebRequest.SendHTTPRequestAsync(string.Format(this._getUpdatesURIFrm, serverName, key, ts), (Action <JsonResponseData>)(jsonResp => { BackendResult <UpdatesResponse, LongPollResultCode> backendResult = new BackendResult <UpdatesResponse, LongPollResultCode>(); if (!jsonResp.IsSucceeded || string.IsNullOrWhiteSpace(jsonResp.JsonString)) { backendResult.ResultCode = LongPollResultCode.CommunicationFailed; } else if (this.ServerReturnedFailure(jsonResp.JsonString)) { backendResult.ResultCode = LongPollResultCode.RequireNewPollServer; } else { backendResult.ResultCode = LongPollResultCode.Succeeded; LongPollServerService.RootObjectGetUpdates objectGetUpdates = JsonConvert.DeserializeObject <LongPollServerService.RootObjectGetUpdates>(jsonResp.JsonString); backendResult.ResultData = new UpdatesResponse(); backendResult.ResultData.ts = (long)objectGetUpdates.ts; backendResult.ResultData.Updates = this.ReadUpdatesResponseFromRaw(objectGetUpdates.updates, new Func <List <object>, LongPollServerUpdateData>(this.GetUpdateDataForNewMessageLongPollData)); } callback(backendResult); }), null); }