WebSocketConst.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace SuperWebSocket
  6. {
  7. class WebSocketConstant
  8. {
  9. public const string Host = "Host";
  10. public const string Connection = "Connection";
  11. public const string SecWebSocketKey1 = "Sec-WebSocket-Key1";
  12. public const string SecWebSocketKey2 = "Sec-WebSocket-Key2";
  13. public const string SecWebSocketKey3 = "Sec-WebSocket-Key3";
  14. public const string SecWebSocketKey = "Sec-WebSocket-Key";
  15. public const string SecWebSocketVersion = "Sec-WebSocket-Version";
  16. public const string SecWebSocketProtocol = "Sec-WebSocket-Protocol";
  17. public const string WebSocketProtocol = "WebSocket-Protocol";
  18. public const string Cookie = "Cookie";
  19. public const string Upgrade = "Upgrade";
  20. public const string Origin = "Origin";
  21. public const string ResponseHeadLine00 = "HTTP/1.1 101 WebSocket Protocol Handshake";
  22. public const string ResponseHeadLine10 = "HTTP/1.1 101 Switching Protocols";
  23. public const string ResponseUpgradeLine = Upgrade + ": WebSocket";
  24. public const string ResponseConnectionLine = Connection + ": Upgrade";
  25. public const string ResponseOriginLine = "Sec-WebSocket-Origin: {0}";
  26. public const string ResponseLocationLine = "Sec-WebSocket-Location: {0}://{1}{2}";
  27. public const string ResponseProtocolLine = SecWebSocketProtocol + ": {0}";
  28. public const string ResponseAcceptLine = "Sec-WebSocket-Accept: {0}";
  29. public const byte StartByte = 0x00;
  30. public const byte EndByte = 0xFF;
  31. public static byte[] ClosingHandshake = new byte[] { 0xFF, 0x00 };
  32. public const string WsSchema = "ws";
  33. public const string WssSchema = "wss";
  34. }
  35. }