jellyfin/MediaBrowser.Controller/Net/IWebSocketConnection.cs

84 lines
2.7 KiB
C#
Raw Normal View History

2014-12-27 15:52:41 -07:00
using MediaBrowser.Model.Net;
2013-03-25 21:33:47 -07:00
using System;
using System.Threading;
using System.Threading.Tasks;
2016-10-25 12:02:04 -07:00
using MediaBrowser.Model.Services;
namespace MediaBrowser.Controller.Net
{
public interface IWebSocketConnection : IDisposable
{
2014-05-17 11:37:40 -07:00
/// <summary>
/// Occurs when [closed].
/// </summary>
event EventHandler<EventArgs> Closed;
2015-03-08 12:48:30 -07:00
2013-10-02 18:22:50 -07:00
/// <summary>
/// Gets the id.
/// </summary>
/// <value>The id.</value>
Guid Id { get; }
2013-05-25 17:53:51 -07:00
/// <summary>
/// Gets the last activity date.
/// </summary>
/// <value>The last activity date.</value>
DateTime LastActivityDate { get; }
2015-03-08 12:48:30 -07:00
/// <summary>
/// Gets or sets the URL.
/// </summary>
/// <value>The URL.</value>
string Url { get; set; }
/// <summary>
/// Gets or sets the query string.
/// </summary>
/// <value>The query string.</value>
2016-10-25 12:02:04 -07:00
QueryParamCollection QueryString { get; set; }
2015-03-08 12:48:30 -07:00
/// <summary>
/// Gets or sets the receive action.
/// </summary>
/// <value>The receive action.</value>
Action<WebSocketMessageInfo> OnReceive { get; set; }
/// <summary>
/// Gets the state.
/// </summary>
/// <value>The state.</value>
WebSocketState State { get; }
/// <summary>
/// Gets the remote end point.
/// </summary>
/// <value>The remote end point.</value>
string RemoteEndPoint { get; }
/// <summary>
/// Sends a message asynchronously.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="message">The message.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException">message</exception>
Task SendAsync<T>(WebSocketMessage<T> message, CancellationToken cancellationToken);
/// <summary>
/// Sends a message asynchronously.
/// </summary>
/// <param name="buffer">The buffer.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task SendAsync(byte[] buffer, CancellationToken cancellationToken);
/// <summary>
/// Sends a message asynchronously.
/// </summary>
2014-07-19 21:46:29 -07:00
/// <param name="text">The text.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
/// <exception cref="System.ArgumentNullException">buffer</exception>
2014-07-19 21:46:29 -07:00
Task SendAsync(string text, CancellationToken cancellationToken);
}
}