diff --git a/NewLife.Remoting/Clients/ClientBase.cs b/NewLife.Remoting/Clients/ClientBase.cs index cea3fd5..50bdf29 100644 --- a/NewLife.Remoting/Clients/ClientBase.cs +++ b/NewLife.Remoting/Clients/ClientBase.cs @@ -183,7 +183,23 @@ protected virtual void OnInit() /// 创建RPC客户端 /// /// - protected virtual ApiClient CreateRpc(String urls) => new MyApiClient { Client = this, Servers = urls.Split(","), Log = Log }; + protected virtual ApiClient CreateRpc(String urls) + { + var client = new MyApiClient { Client = this, Servers = urls.Split(","), Log = Log }; + client.Received += (s, e) => + { + var msg = e.Message; + var api = e.ApiMessage; + if (msg != null && !msg.Reply && api != null && api.Action == "Notify") + { + var cmd = api.Data?.ToStr().ToJsonEntity(); + if (cmd != null) + _ = ReceiveCommand(cmd, client.Local?.Type + ""); + } + }; + + return client; + } class MyApiClient : ApiClient {