public void PostMessage (BinaryMessage message) { message.ReadCustomData (); var interceptor = Interceptor; if (interceptor != null && !interceptor.PreProcessMessage (message)) return; PostMessage (message, null, true); }
public Task<BinaryMessage> SendMessage (BinaryMessage message) { message.ReadCustomData (); var interceptor = Interceptor; if (interceptor != null && !interceptor.PreProcessMessage (message)) return Task.FromResult (message.CreateErrorResponse ("Message was refused by interceptor")); var cs = new TaskCompletionSource<BinaryMessage> (); PostMessage (message, cs, true); return cs.Task; }
public void WriteMessage(byte type, BinaryMessage msg) { msg.ReadCustomData(); lock (listeners) { if (DebugMode) { Console.WriteLine("[SERVER] XS << RP " + type + " [" + msg.ProcessingTime + "ms] " + msg); } outStream.WriteByte(type); try { msg.Write(outStream); } catch (Exception ex) { msg.CreateErrorResponse(ex.ToString(), true).Write(outStream); } } }