mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-06 18:26:33 +00:00
Rewrite WebSocket handling code
This commit is contained in:
@@ -154,7 +154,6 @@ namespace MediaBrowser.Controller.Net
|
||||
{
|
||||
MessageType = Name,
|
||||
Data = data
|
||||
|
||||
}, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
state.DateLastSendUtc = DateTime.UtcNow;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Events;
|
||||
using MediaBrowser.Model.Services;
|
||||
@@ -19,11 +18,6 @@ namespace MediaBrowser.Controller.Net
|
||||
/// <value>The URL prefix.</value>
|
||||
string[] UrlPrefixes { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Stops this instance.
|
||||
/// </summary>
|
||||
void Stop();
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when [web socket connected].
|
||||
/// </summary>
|
||||
@@ -39,23 +33,11 @@ namespace MediaBrowser.Controller.Net
|
||||
/// </summary>
|
||||
string GlobalResponse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Sends the http context to the socket listener
|
||||
/// </summary>
|
||||
/// <param name="ctx"></param>
|
||||
/// <returns></returns>
|
||||
Task ProcessWebSocketRequest(HttpContext ctx);
|
||||
|
||||
/// <summary>
|
||||
/// The HTTP request handler
|
||||
/// </summary>
|
||||
/// <param name="httpReq"></param>
|
||||
/// <param name="urlString"></param>
|
||||
/// <param name="host"></param>
|
||||
/// <param name="localPath"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
Task RequestHandler(IHttpRequest httpReq, string urlString, string host, string localPath,
|
||||
CancellationToken cancellationToken);
|
||||
Task RequestHandler(HttpContext context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Net;
|
||||
using MediaBrowser.Model.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace MediaBrowser.Controller.Net
|
||||
@@ -15,12 +15,6 @@ namespace MediaBrowser.Controller.Net
|
||||
/// </summary>
|
||||
event EventHandler<EventArgs> Closed;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the id.
|
||||
/// </summary>
|
||||
/// <value>The id.</value>
|
||||
Guid Id { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the last activity date.
|
||||
/// </summary>
|
||||
@@ -32,6 +26,7 @@ namespace MediaBrowser.Controller.Net
|
||||
/// </summary>
|
||||
/// <value>The URL.</value>
|
||||
string Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the query string.
|
||||
/// </summary>
|
||||
@@ -54,7 +49,7 @@ namespace MediaBrowser.Controller.Net
|
||||
/// Gets the remote end point.
|
||||
/// </summary>
|
||||
/// <value>The remote end point.</value>
|
||||
string RemoteEndPoint { get; }
|
||||
IPAddress RemoteEndPoint { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Sends a message asynchronously.
|
||||
@@ -66,21 +61,6 @@ namespace MediaBrowser.Controller.Net
|
||||
/// <exception cref="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>
|
||||
/// <param name="text">The text.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="ArgumentNullException">buffer</exception>
|
||||
Task SendAsync(string text, CancellationToken cancellationToken);
|
||||
Task ProcessAsync(CancellationToken cancellationToken = default);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user