2014-12-27 22:52:41 +00:00
|
|
|
|
using MediaBrowser.Model.Net;
|
2013-03-26 04:33:47 +00:00
|
|
|
|
using System;
|
2013-02-26 16:10:55 +00:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2016-10-25 19:02:04 +00:00
|
|
|
|
using MediaBrowser.Model.Services;
|
2013-02-26 16:10:55 +00:00
|
|
|
|
|
2014-12-27 18:06:32 +00:00
|
|
|
|
namespace MediaBrowser.Controller.Net
|
2013-02-26 16:10:55 +00:00
|
|
|
|
{
|
|
|
|
|
public interface IWebSocketConnection : IDisposable
|
|
|
|
|
{
|
2014-05-17 18:37:40 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [closed].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<EventArgs> Closed;
|
2015-03-08 19:48:30 +00:00
|
|
|
|
|
2013-10-03 01:22:50 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the id.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The id.</value>
|
|
|
|
|
Guid Id { get; }
|
|
|
|
|
|
2013-05-26 00:53:51 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the last activity date.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The last activity date.</value>
|
|
|
|
|
DateTime LastActivityDate { get; }
|
|
|
|
|
|
2015-03-08 19:48:30 +00: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 19:02:04 +00:00
|
|
|
|
QueryParamCollection QueryString { get; set; }
|
2015-03-08 19:48:30 +00:00
|
|
|
|
|
2013-02-26 16:10:55 +00: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-20 04:46:29 +00:00
|
|
|
|
/// <param name="text">The text.</param>
|
2013-02-26 16:10:55 +00:00
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
/// <exception cref="System.ArgumentNullException">buffer</exception>
|
2014-07-20 04:46:29 +00:00
|
|
|
|
Task SendAsync(string text, CancellationToken cancellationToken);
|
2013-02-26 16:10:55 +00:00
|
|
|
|
}
|
|
|
|
|
}
|