IRPCClientTransport.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Threading;
  3. using InABox.Clients;
  4. using InABox.Core;
  5. namespace InABox.Rpc
  6. {
  7. public interface IRpcClientTransport : IRpcTransport
  8. {
  9. event RpcTransportOpenEvent OnOpen;
  10. event RpcTransportCloseEvent OnClose;
  11. event RpcTransportExceptionEvent OnException;
  12. bool Ping();
  13. DatabaseInfo? Info();
  14. /// <summary>
  15. /// Connect to remote server.
  16. /// </summary>
  17. /// <param name="ct">Cancellation token to cancel the connection.</param>
  18. /// <returns><see langword="true"/> if connection success, <see langword="false"/> otherwise.</returns>
  19. bool Connect(CancellationToken ct = default);
  20. void Send(RpcMessage message);
  21. RpcMessage Send(string command, ISerializeBinary parameters, bool checkErrors = true);
  22. void Disconnect();
  23. event RpcTransportMessageEvent OnMessage;
  24. bool IsConnected();
  25. bool IsSecure();
  26. string? ServerName();
  27. }
  28. }