说明

基本的调用完全和Tcp的一致。直接示例demo

  1. static void Main(string[] args)
  2. {
  3. WSTouchRpcClient client = new WSTouchRpcClient();
  4. client.Handshaked += Client_Handshaked;
  5. client.Setup(new RRQMConfig()
  6. .SetRemoteIPHost("ws://127.0.0.1:5000/wstouchrpc"));
  7. client.ConnectAsync();
  8. while (true)
  9. {
  10. string[] strs = Console.ReadLine().Split(' ');
  11. if (strs.Length != 2)
  12. {
  13. Console.WriteLine("参数不对");
  14. continue;
  15. }
  16. Console.WriteLine(client.Invoke<bool>("TouchRpcWebApplication.RpcProviders.TestServerProvider.Login".ToLower(), null, strs[0], strs[1]));
  17. Console.ReadKey();
  18. }
  19. }
  20. private static void Client_Handshaked(WSTouchRpcClient client, VerifyOptionEventArgs e)
  21. {
  22. client.Logger.Message("成功连接");
  23. }