ServerAckMessage.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using SocketIOClient.Transport;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace SocketIOClient.Messages
  5. {
  6. /// <summary>
  7. /// The client calls the server's callback
  8. /// </summary>
  9. public class ServerAckMessage : IMessage
  10. {
  11. public MessageType Type => MessageType.AckMessage;
  12. public string Namespace { get; set; }
  13. public string Json { get; set; }
  14. public int Id { get; set; }
  15. public List<byte[]> OutgoingBytes { get; set; }
  16. public List<byte[]> IncomingBytes { get; set; }
  17. public int BinaryCount { get; }
  18. public int Eio { get; set; }
  19. public TransportProtocol Protocol { get; set; }
  20. public void Read(string msg)
  21. {
  22. }
  23. public string Write()
  24. {
  25. var builder = new StringBuilder();
  26. builder.Append("43");
  27. if (!string.IsNullOrEmpty(Namespace))
  28. {
  29. builder.Append(Namespace).Append(',');
  30. }
  31. builder.Append(Id);
  32. if (string.IsNullOrEmpty(Json))
  33. {
  34. builder.Append("[]");
  35. }
  36. else
  37. {
  38. builder.Append(Json);
  39. }
  40. return builder.ToString();
  41. }
  42. }
  43. }