using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Net; using System.Security.Principal; using System.Threading; using EmbedIO.Sessions; namespace EmbedIO.WebSockets { /// /// Represents the context of a WebSocket connection. /// public interface IWebSocketContext { /// /// Gets a unique identifier for a WebSocket context. /// string Id { get; } /// /// Gets the used to cancel operations. /// CancellationToken CancellationToken { get; } /// /// Gets the unique identifier of the opening handshake HTTP context. /// string HttpContextId { get; } /// /// Gets the session proxy associated with the opening handshake HTTP context. /// ISessionProxy Session { get; } /// /// Gets the dictionary of data associated with the opening handshake HTTP context. /// IDictionary Items { get; } /// /// Gets the server IP address and port number to which the opening handshake request is directed. /// IPEndPoint LocalEndPoint { get; } /// /// Gets the client IP address and port number from which the opening handshake request originated. /// IPEndPoint RemoteEndPoint { get; } /// The URI requested by the WebSocket client. Uri RequestUri { get; } /// The HTTP headers that were sent to the server during the opening handshake. NameValueCollection Headers { get; } /// The value of the Origin HTTP header included in the opening handshake. string Origin { get; } /// The value of the SecWebSocketKey HTTP header included in the opening handshake. string WebSocketVersion { get; } /// The list of subprotocols requested by the WebSocket client. IEnumerable RequestedProtocols { get; } /// The accepted subprotocol. string AcceptedProtocol { get; } /// The cookies that were passed to the server during the opening handshake. ICookieCollection Cookies { get; } /// An object used to obtain identity, authentication information, and security roles for the WebSocket client. IPrincipal User { get; } /// Whether the WebSocket client is authenticated. bool IsAuthenticated { get; } /// Whether the WebSocket client connected from the local machine. bool IsLocal { get; } /// Whether the WebSocket connection is secured using Secure Sockets Layer (SSL). bool IsSecureConnection { get; } /// The interface used to interact with the WebSocket connection. IWebSocket WebSocket { get; } } }