Message.cs 979 B

123456789101112131415161718192021222324252627282930313233343536
  1. #if !BESTHTTP_DISABLE_SERVERSENT_EVENTS
  2. using System;
  3. namespace BestHTTP.ServerSentEvents
  4. {
  5. public sealed class Message
  6. {
  7. /// <summary>
  8. /// Event Id of the message. If it's null, then it's not present.
  9. /// </summary>
  10. public string Id { get; internal set; }
  11. /// <summary>
  12. /// Name of the event, or an empty string.
  13. /// </summary>
  14. public string Event { get; internal set; }
  15. /// <summary>
  16. /// The actual payload of the message.
  17. /// </summary>
  18. public string Data { get; internal set; }
  19. /// <summary>
  20. /// A reconnection time, in milliseconds. This must initially be a user-agent-defined value, probably in the region of a few seconds.
  21. /// </summary>
  22. public TimeSpan Retry { get; internal set; }
  23. public override string ToString()
  24. {
  25. return string.Format("\"{0}\": \"{1}\"", Event, Data);
  26. }
  27. }
  28. }
  29. #endif