IDisconnectingPlugin.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using TouchSocket.Core;
  7. namespace TouchSocket.Sockets
  8. {
  9. /// <summary>
  10. /// 具有预断开连接插件接口
  11. /// </summary>
  12. public interface IDisconnectingPlugin:IPlugin
  13. {
  14. /// <summary>
  15. /// 即将断开连接(仅主动断开时有效)。
  16. /// <para>
  17. /// 当主动调用Close断开时,可通过<see cref="TouchSocketEventArgs.IsPermitOperation"/>终止断开行为。
  18. /// </para>
  19. /// </summary>
  20. /// <param name="client">客户端</param>
  21. /// <param name="e">参数</param>
  22. [AsyncRaiser]
  23. void OnDisconnecting(object client, DisconnectEventArgs e);
  24. /// <summary>
  25. /// 即将断开连接(仅主动断开时有效)。
  26. /// <para>
  27. /// 当主动调用Close断开时,可通过<see cref="TouchSocketEventArgs.IsPermitOperation"/>终止断开行为。
  28. /// </para>
  29. /// </summary>
  30. /// <param name="client"></param>
  31. /// <param name="e"></param>
  32. /// <returns></returns>
  33. Task OnDisconnectingAsync(object client, DisconnectEventArgs e);
  34. }
  35. }