public void GET(string key, RequestInfo info) { bool isError; long id = 0; long.TryParse(key, out id); if (info.LongPollCheck(Program.StatusEventNotifyer, ref id, out isError)) { //Make sure we do not report a higher number than the eventnotifyer says var st = new Serializable.ServerStatus(); st.LastEventID = id; info.OutputOK(st); } else if (!isError) { info.OutputOK(new Serializable.ServerStatus()); } }
public class ServerState : IRESTMethodGET, IRESTMethodPOST, IRESTMethodDocumented
private void GetCurrentState (HttpServer.IHttpRequest request, HttpServer.IHttpResponse response, HttpServer.Sessions.IHttpSession session, BodyWriter bw) { bool isError; long id = 0; if (LongPollCheck(request, response, bw, Program.StatusEventNotifyer, ref id, out isError)) { //Make sure we do not report a higher number than the eventnotifyer says var st = new Serializable.ServerStatus(); st.LastEventID = id; bw.OutputOK(st); } else if (!isError) { bw.OutputOK(new Serializable.ServerStatus()); } }