Protocol.cs 878 B

1234567891011121314151617181920212223242526272829
  1. // relay protocol definitions
  2. namespace Edgegap
  3. {
  4. public enum ConnectionState : byte
  5. {
  6. Disconnected = 0, // until the user calls connect()
  7. Checking = 1, // recently connected, validation in progress
  8. Valid = 2, // validation succeeded
  9. Invalid = 3, // validation rejected by tower
  10. SessionTimeout = 4, // session owner timed out
  11. Error = 5, // other error
  12. }
  13. public enum MessageType : byte
  14. {
  15. Ping = 1,
  16. Data = 2
  17. }
  18. public static class Protocol
  19. {
  20. // MTU: relay adds up to 13 bytes of metadata in the worst case.
  21. public const int Overhead = 13;
  22. // ping interval should be between 100 ms and 1 second.
  23. // faster ping gives faster authentication, but higher bandwidth.
  24. public const float PingInterval = 0.5f;
  25. }
  26. }