jellyfin-server/MediaBrowser.Controller/Net/IServerManager.cs

65 lines
2.6 KiB
C#
Raw Normal View History

2015-03-08 19:48:30 +00:00
using MediaBrowser.Model.Events;
2014-11-26 04:12:29 +00:00
using System;
2013-02-27 16:46:48 +00:00
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
2014-11-26 04:12:29 +00:00
namespace MediaBrowser.Controller.Net
{
/// <summary>
/// Interface IServerManager
/// </summary>
public interface IServerManager : IDisposable
{
/// <summary>
/// Starts this instance.
/// </summary>
2014-01-09 04:44:51 +00:00
/// <param name="urlPrefixes">The URL prefixes.</param>
2016-11-11 03:29:51 +00:00
void Start(IEnumerable<string> urlPrefixes);
/// <summary>
/// Sends a message to all clients currently connected via a web socket
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="messageType">Type of the message.</param>
/// <param name="data">The data.</param>
/// <returns>Task.</returns>
void SendWebSocketMessage<T>(string messageType, T data);
/// <summary>
/// Sends a message to all clients currently connected via a web socket
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="messageType">Type of the message.</param>
/// <param name="dataFunction">The function that generates the data to send, if there are any connected clients</param>
void SendWebSocketMessage<T>(string messageType, Func<T> dataFunction);
/// <summary>
/// Sends a message to all clients currently connected via a web socket
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="messageType">Type of the message.</param>
/// <param name="dataFunction">The function that generates the data to send, if there are any connected clients</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException">messageType</exception>
Task SendWebSocketMessageAsync<T>(string messageType, Func<T> dataFunction, CancellationToken cancellationToken);
2013-02-27 16:46:48 +00:00
/// <summary>
/// Adds the web socket listeners.
/// </summary>
/// <param name="listeners">The listeners.</param>
void AddWebSocketListeners(IEnumerable<IWebSocketListener> listeners);
/// <summary>
/// Gets the web socket connections.
/// </summary>
/// <value>The web socket connections.</value>
IEnumerable<IWebSocketConnection> WebSocketConnections { get; }
2015-03-08 19:48:30 +00:00
/// <summary>
/// Occurs when [web socket connected].
/// </summary>
event EventHandler<GenericEventArgs<IWebSocketConnection>> WebSocketConnected;
}
}