public ReplyData Heartbeat(IPAddress remoteIP, int remotePort, List <string> arguments, string body, string method, Dictionary <string, string> Headers) { ReplyData _reply = new ReplyData(); Heartbeat_Memory mem = Heartbeat_Memory.GetHeartbeat(); if (mem.Contains(remoteIP.ToString())) { mem.Set(remoteIP.ToString(), Guid.NewGuid().ToString()); } else { mem.Add(remoteIP.ToString(), Guid.NewGuid().ToString()); } heartbeat_ReplyData hbrd = new heartbeat_ReplyData(); hbrd.status = "success"; hbrd.data = new Dictionary <string, string>(); hbrd.data.Add("session_id", mem.Get(remoteIP.ToString())); _reply.Status = 200; _reply.Body = JsonConvert.SerializeObject(hbrd); Console.WriteLine("====> heartbeat reply: " + _reply.Body); return(_reply); }
public RESTReplyData Heartbeat(RESTRequestData pReq, List <string> pArgs) { RESTReplyData _reply = new RESTReplyData(); Heartbeat_Memory mem = Heartbeat_Memory.GetHeartbeat(); if (mem.Contains(pReq.RemoteUser.ToString())) { mem.Set(pReq.RemoteUser.ToString(), Guid.NewGuid().ToString()); } else { mem.Add(pReq.RemoteUser.ToString(), Guid.NewGuid().ToString()); } heartbeat_ReplyData hbrd = new heartbeat_ReplyData(); hbrd.status = "success"; hbrd.data = new Dictionary <string, string>(); hbrd.data.Add("session_id", mem.Get(pReq.RemoteUser.ToString())); _reply.Status = 200; _reply.Body = JsonConvert.SerializeObject(hbrd); return(_reply); }