IServicePlugin.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using TouchSocket.Core;
  2. using System.Threading.Tasks;
  3. using System;
  4. namespace TouchSocket.Sockets
  5. {
  6. /// <summary>
  7. /// IServicePlugin
  8. /// </summary>
  9. public interface IServicePlugin : IPlugin
  10. {
  11. /// <summary>
  12. /// 当服务器执行<see cref="IService.Start"/>后时。
  13. /// <para>
  14. /// 注意:此处并不表示服务器成功启动,具体状态请看<see cref="ServiceStateEventArgs.ServerState"/>
  15. /// </para>
  16. /// </summary>
  17. /// <param name="sender"></param>
  18. /// <param name="e"></param>
  19. [AsyncRaiser]
  20. void OnStarted(object sender, ServiceStateEventArgs e);
  21. /// <summary>
  22. /// 当服务器执行<see cref="IService.Start"/>后时。
  23. /// <para>
  24. /// 注意:此处并不表示服务器成功启动,具体状态请看<see cref="ServiceStateEventArgs.ServerState"/>
  25. /// </para>
  26. /// </summary>
  27. /// <param name="sender"></param>
  28. /// <param name="e"></param>
  29. Task OnStartedAsync(object sender, ServiceStateEventArgs e);
  30. /// <summary>
  31. /// 当服务器调用<see cref="IService.Stop"/>或者<see cref="IDisposable.Dispose"/>时
  32. /// </summary>
  33. /// <param name="sender"></param>
  34. /// <param name="e"></param>
  35. [AsyncRaiser]
  36. void OnStoped(object sender, ServiceStateEventArgs e);
  37. /// <summary>
  38. /// 当服务器调用<see cref="IService.Stop"/>或者<see cref="IDisposable.Dispose"/>时
  39. /// </summary>
  40. /// <param name="sender"></param>
  41. /// <param name="e"></param>
  42. Task OnStopedAsync(object sender, ServiceStateEventArgs e);
  43. }
  44. }