internal LongPollingResult EndHandlingLongPollingRequest(IAsyncResult asyncResult, int start) { var result = new LongPollingResult { type = "rpc", name = "message" }; try { if (asyncResult is SyncAsyncResult) { result = (LongPollingResult)asyncResult.AsyncState; } else { var msgs = messageQueue.EndTake(asyncResult); result.nextStart = start + msgs.Count; result.data = msgs; result.success = true; previousLongPollingResult = result; } } catch (Exception ex) { result.success = false; result.data = new DextopRemoteMethodCallException { type = "rpc", exception = ex.Message, stackTrace = ex.StackTrace }; } return(result); }
internal LongPollingResult HandleLongPollingRequest(HttpContext context) { var result = new LongPollingResult { type = "rpc", name = "message" }; try { int start; if (!int.TryParse(context.Request["start"], out start)) { start = 0; } int nextStart; var msgs = PopMessagesOrWait(start, out nextStart, TimeSpan.FromSeconds(20)); result.nextStart = nextStart; result.data = msgs; result.success = true; } catch (Exception ex) { result.success = false; result.data = new DextopRemoteMethodCallException { type = "rpc", exception = ex.Message, stackTrace = ex.StackTrace }; } return(result); }