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;
|
2013-02-26 16:10:55 +00:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2014-11-26 04:12:29 +00:00
|
|
|
|
namespace MediaBrowser.Controller.Net
|
2013-02-26 16:10:55 +00:00
|
|
|
|
{
|
2013-09-20 15:37:05 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface IServerManager
|
|
|
|
|
/// </summary>
|
2013-02-26 16:10:55 +00:00
|
|
|
|
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);
|
2013-09-20 15:37:05 +00:00
|
|
|
|
|
2013-02-26 16:10:55 +00:00
|
|
|
|
/// <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);
|
2013-05-22 03:42:25 +00:00
|
|
|
|
|
|
|
|
|
/// <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;
|
2013-02-26 16:10:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|