using MediaBrowser.Controller;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.System;
using System.Threading.Tasks;
namespace MediaBrowser.Api.System
{
///
/// Class SystemInfoWebSocketListener
///
public class SystemInfoWebSocketListener : BasePeriodicWebSocketListener
{
///
/// Gets the name.
///
/// The name.
protected override string Name
{
get { return "SystemInfo"; }
}
///
/// The _kernel
///
private readonly IServerApplicationHost _appHost;
///
/// Initializes a new instance of the class.
///
/// The logger.
/// The app host.
public SystemInfoWebSocketListener(ILogger logger, IServerApplicationHost appHost)
: base(logger)
{
_appHost = appHost;
}
///
/// Gets the data to send.
///
/// The state.
/// Task{SystemInfo}.
protected override Task GetDataToSend(WebSocketListenerState state)
{
return Task.FromResult(_appHost.GetSystemInfo());
}
}
}