コード例 #1
0
		public void PostMessage (BinaryMessage message)
		{
			message.ReadCustomData ();
			var interceptor = Interceptor;
			if (interceptor != null && !interceptor.PreProcessMessage (message))
				return;

			PostMessage (message, null, true);
		}
コード例 #2
0
		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;
		}
コード例 #3
0
 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);
         }
     }
 }