Interfaces.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #if !BESTHTTP_DISABLE_SOCKETIO
  2. namespace BestHTTP.SocketIO
  3. {
  4. using BestHTTP.SocketIO.Transports;
  5. /// <summary>
  6. /// Interface to hide internal functions from the user by implementing it as an explicit interface.
  7. /// </summary>
  8. public interface IManager
  9. {
  10. void Remove(Socket socket);
  11. void Close(bool removeSockets = true);
  12. void TryToReconnect();
  13. bool OnTransportConnected(ITransport transport);
  14. void OnTransportError(ITransport trans, string err);
  15. void OnTransportProbed(ITransport trans);
  16. void SendPacket(Packet packet);
  17. void OnPacket(Packet packet);
  18. void EmitEvent(string eventName, params object[] args);
  19. void EmitEvent(SocketIOEventTypes type, params object[] args);
  20. void EmitError(SocketIOErrors errCode, string msg);
  21. void EmitAll(string eventName, params object[] args);
  22. }
  23. /// <summary>
  24. /// Interface to hide internal functions from the user by implementing it as an explicit interface.
  25. /// </summary>
  26. public interface ISocket
  27. {
  28. void Open();
  29. void Disconnect(bool remove);
  30. void OnPacket(Packet packet);
  31. void EmitEvent(SocketIOEventTypes type, params object[] args);
  32. void EmitEvent(string eventName, params object[] args);
  33. void EmitError(SocketIOErrors errCode, string msg);
  34. }
  35. }
  36. #endif