IRPCClientTransport.cs 1.1 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. bool Ping();
  10. DatabaseInfo? Info();
  11. /// <summary>
  12. /// Connect to remote server.
  13. /// </summary>
  14. /// <param name="ct">Cancellation token to cancel the connection.</param>
  15. /// <returns><see langword="true"/> if connection success, <see langword="false"/> otherwise.</returns>
  16. bool Connect(CancellationToken ct = default);
  17. void Send(RpcMessage message);
  18. TResult Send<TCommand, TParameters, TResult>(TParameters parameters)
  19. where TCommand : IRpcCommand<TParameters,TResult>
  20. where TParameters : IRpcCommandParameters, ISerializeBinary
  21. where TResult : IRpcCommandResult, ISerializeBinary, new();
  22. void Disconnect();
  23. event RpcTransportMessageEvent OnMessage;
  24. bool IsConnected();
  25. bool IsSecure();
  26. string? ServerName();
  27. }
  28. }