ISubProtocol.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Reflection;
  5. using System.Text;
  6. using SuperSocket.SocketBase.Logging;
  7. using SuperSocket.SocketBase.Command;
  8. using SuperSocket.SocketBase.Config;
  9. using SuperSocket.SocketBase.Protocol;
  10. using SuperWebSocket.Config;
  11. using SuperSocket.SocketBase;
  12. namespace SuperWebSocket.SubProtocol
  13. {
  14. /// <summary>
  15. /// SubProtocol interface
  16. /// </summary>
  17. /// <typeparam name="TWebSocketSession">The type of the web socket session.</typeparam>
  18. public interface ISubProtocol<TWebSocketSession>
  19. where TWebSocketSession : WebSocketSession<TWebSocketSession>, new()
  20. {
  21. /// <summary>
  22. /// Initializes with the specified config.
  23. /// </summary>
  24. /// <param name="appServer">The app server.</param>
  25. /// <param name="protocolConfig">The protocol config.</param>
  26. /// <param name="logger">The logger.</param>
  27. /// <returns></returns>
  28. bool Initialize(IAppServer appServer, SubProtocolConfig protocolConfig, ILog logger);
  29. /// <summary>
  30. /// Gets the name.
  31. /// </summary>
  32. string Name { get; }
  33. /// <summary>
  34. /// Gets the sub request parser.
  35. /// </summary>
  36. IRequestInfoParser<SubRequestInfo> SubRequestParser { get; }
  37. /// <summary>
  38. /// Tries the get command.
  39. /// </summary>
  40. /// <param name="name">The name.</param>
  41. /// <param name="command">The command.</param>
  42. /// <returns></returns>
  43. bool TryGetCommand(string name, out ISubCommand<TWebSocketSession> command);
  44. }
  45. }