Message.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #if !BESTHTTP_DISABLE_SERVERSENT_EVENTS
  2. using System;
  3. namespace BestHTTP.ServerSentEvents
  4. {
  5. [PlatformSupport.IL2CPP.Preserve]
  6. public sealed class Message
  7. {
  8. /// <summary>
  9. /// Event Id of the message. If it's null, then it's not present.
  10. /// </summary>
  11. [PlatformSupport.IL2CPP.Preserve]
  12. public string Id { get; internal set; }
  13. /// <summary>
  14. /// Name of the event, or an empty string.
  15. /// </summary>
  16. [PlatformSupport.IL2CPP.Preserve]
  17. public string Event { get; internal set; }
  18. /// <summary>
  19. /// The actual payload of the message.
  20. /// </summary>
  21. [PlatformSupport.IL2CPP.Preserve]
  22. public string Data { get; internal set; }
  23. /// <summary>
  24. /// A reconnection time, in milliseconds. This must initially be a user-agent-defined value, probably in the region of a few seconds.
  25. /// </summary>
  26. [PlatformSupport.IL2CPP.Preserve]
  27. public TimeSpan Retry { get; internal set; }
  28. /// <summary>
  29. /// If this is true, the Data property holds the comment sent by the server.
  30. /// </summary>
  31. [PlatformSupport.IL2CPP.Preserve]
  32. internal bool IsComment { get; set; }
  33. public override string ToString()
  34. {
  35. return string.Format("\"{0}\": \"{1}\"", Event, Data);
  36. }
  37. }
  38. }
  39. #endif