2015-03-08 12:48:30 -07:00
|
|
|
|
using MediaBrowser.Model.Events;
|
2014-11-25 21:12:29 -07:00
|
|
|
|
using System;
|
2013-02-27 09:46:48 -07:00
|
|
|
|
using System.Collections.Generic;
|
2013-02-26 09:10:55 -07:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2014-11-25 21:12:29 -07:00
|
|
|
|
namespace MediaBrowser.Controller.Net
|
2013-02-26 09:10:55 -07:00
|
|
|
|
{
|
2013-09-20 08:37:05 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface IServerManager
|
|
|
|
|
/// </summary>
|
2013-02-26 09:10:55 -07:00
|
|
|
|
public interface IServerManager : IDisposable
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Starts this instance.
|
|
|
|
|
/// </summary>
|
2014-01-08 21:44:51 -07:00
|
|
|
|
/// <param name="urlPrefixes">The URL prefixes.</param>
|
2015-01-06 20:36:42 -07:00
|
|
|
|
/// <param name="certificatePath">If an https prefix is specified,
|
|
|
|
|
/// the ssl certificate localtion on the file system.</param>
|
|
|
|
|
void Start(IEnumerable<string> urlPrefixes, string certificatePath);
|
2013-09-20 08:37:05 -07:00
|
|
|
|
|
2013-02-26 09:10:55 -07: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 09:46:48 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adds the web socket listeners.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="listeners">The listeners.</param>
|
|
|
|
|
void AddWebSocketListeners(IEnumerable<IWebSocketListener> listeners);
|
2013-05-21 20:42:25 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the web socket connections.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The web socket connections.</value>
|
|
|
|
|
IEnumerable<IWebSocketConnection> WebSocketConnections { get; }
|
2015-03-08 12:48:30 -07:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [web socket connected].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<GenericEventArgs<IWebSocketConnection>> WebSocketConnected;
|
2013-02-26 09:10:55 -07:00
|
|
|
|
}
|
|
|
|
|
}
|