using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Common.Net { public interface IServerManager : IDisposable { /// /// Gets a value indicating whether [supports web socket]. /// /// true if [supports web socket]; otherwise, false. bool SupportsNativeWebSocket { get; } /// /// Gets the web socket port number. /// /// The web socket port number. int WebSocketPortNumber { get; } /// /// Starts this instance. /// void Start(); /// /// Sends a message to all clients currently connected via a web socket /// /// /// Type of the message. /// The data. /// Task. void SendWebSocketMessage(string messageType, T data); /// /// Sends a message to all clients currently connected via a web socket /// /// /// Type of the message. /// The function that generates the data to send, if there are any connected clients void SendWebSocketMessage(string messageType, Func dataFunction); /// /// Sends a message to all clients currently connected via a web socket /// /// /// Type of the message. /// The function that generates the data to send, if there are any connected clients /// The cancellation token. /// Task. /// messageType Task SendWebSocketMessageAsync(string messageType, Func dataFunction, CancellationToken cancellationToken); /// /// Adds the web socket listeners. /// /// The listeners. void AddWebSocketListeners(IEnumerable listeners); } }