public static PHandler getNext() { PHandler pHandler = null; _payloads.TryDequeue(out pHandler); return(pHandler); }
public static void Handle(byte[] payloadbytes, ConnInfo connInfo) { var payloadString = Encoding.UTF8.GetString(payloadbytes); if (payloadString.StartsWith("#")) { connInfo.newsCategory = payloadString.Split("#").LastOrDefault(); Connections.Add(connInfo); } else { PHandler pHandler = JsonConvert.DeserializeObject <PHandler>(payloadString); PStorage.Add(pHandler); } Console.WriteLine(payloadString); }
public static void Add(PHandler pHandler) { _payloads.Enqueue(pHandler); }