IHttpServer.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Threading;
  4. using System.Threading.Tasks;
  5. using MediaBrowser.Model.Events;
  6. using MediaBrowser.Model.Services;
  7. using Microsoft.AspNetCore.Http;
  8. namespace MediaBrowser.Controller.Net
  9. {
  10. /// <summary>
  11. /// Interface IHttpServer
  12. /// </summary>
  13. public interface IHttpServer : IDisposable
  14. {
  15. /// <summary>
  16. /// Gets the URL prefix.
  17. /// </summary>
  18. /// <value>The URL prefix.</value>
  19. string[] UrlPrefixes { get; }
  20. /// <summary>
  21. /// Stops this instance.
  22. /// </summary>
  23. void Stop();
  24. /// <summary>
  25. /// Occurs when [web socket connected].
  26. /// </summary>
  27. event EventHandler<GenericEventArgs<IWebSocketConnection>> WebSocketConnected;
  28. /// <summary>
  29. /// Inits this instance.
  30. /// </summary>
  31. void Init(IEnumerable<IService> services, IEnumerable<IWebSocketListener> listener, IEnumerable<string> urlPrefixes);
  32. /// <summary>
  33. /// If set, all requests will respond with this message
  34. /// </summary>
  35. string GlobalResponse { get; set; }
  36. /// <summary>
  37. /// Sends the http context to the socket listener
  38. /// </summary>
  39. /// <param name="ctx"></param>
  40. /// <returns></returns>
  41. Task ProcessWebSocketRequest(HttpContext ctx);
  42. /// <summary>
  43. /// The HTTP request handler
  44. /// </summary>
  45. /// <param name="httpReq"></param>
  46. /// <param name="urlString"></param>
  47. /// <param name="host"></param>
  48. /// <param name="localPath"></param>
  49. /// <param name="cancellationToken"></param>
  50. /// <returns></returns>
  51. Task RequestHandler(IHttpRequest httpReq, string urlString, string host, string localPath,
  52. CancellationToken cancellationToken);
  53. }
  54. }