ServerSentEvent.cs 784 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Client.SSE
  6. {
  7. public class ServerSentEvent
  8. {
  9. public string LastEventId { get; set; }
  10. public string EventType { get; set; }
  11. public string Data { get; set; }
  12. public int? Retry { get; set; }
  13. public override string ToString()
  14. {
  15. StringBuilder sb = new StringBuilder();
  16. sb.Append("EventType: ").Append(EventType).AppendLine();
  17. sb.Append("Data: ").Append(Data).AppendLine();
  18. sb.Append("LastEventId: ").Append(LastEventId).AppendLine();
  19. if(Retry.HasValue)
  20. sb.Append("Retry: ").Append(Retry.Value).AppendLine();
  21. return sb.ToString();
  22. }
  23. }
  24. }