Pong.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using SuperSocket.SocketBase.Command;
  6. using SuperWebSocket.Protocol;
  7. namespace SuperWebSocket.Command
  8. {
  9. /// <summary>
  10. /// The command handling Pong
  11. /// </summary>
  12. /// <typeparam name="TWebSocketSession">The type of the web socket session.</typeparam>
  13. class Pong<TWebSocketSession> : FragmentCommand<TWebSocketSession>
  14. where TWebSocketSession : WebSocketSession<TWebSocketSession>, new()
  15. {
  16. /// <summary>
  17. /// Gets the name.
  18. /// </summary>
  19. public override string Name
  20. {
  21. get
  22. {
  23. return OpCode.PongTag;
  24. }
  25. }
  26. /// <summary>
  27. /// Executes the command.
  28. /// </summary>
  29. /// <param name="session">The session.</param>
  30. /// <param name="requestInfo">The request info.</param>
  31. public override void ExecuteCommand(TWebSocketSession session, IWebSocketFragment requestInfo)
  32. {
  33. //Do nothing, last active time has been updated automatically
  34. var frame = requestInfo as WebSocketDataFrame;
  35. if (!CheckControlFrame(frame))
  36. {
  37. session.Close();
  38. return;
  39. }
  40. }
  41. }
  42. }