Interface ISocketConnection
- Namespace
- HotChocolate.AspNetCore.Subscriptions
- Assembly
- HotChocolate.AspNetCore.dll
The socket connection represent an accepted connection with a socket where the protocol is already negotiated.
public interface ISocketConnection : ISocket, IHasContextData, IDisposable
- Inherited Members
- Extension Methods
Properties
HttpContext
Gets access to the HTTP Context.
HttpContext HttpContext { get; }
Property Value
RequestAborted
Get the request cancellation token.
CancellationToken RequestAborted { get; }
Property Value
RequestServices
Gets access to the request scoped service provider.
IServiceProvider RequestServices { get; }
Property Value
Methods
CloseAsync(string, ConnectionCloseReason, CancellationToken)
Closes the connection with the client.
ValueTask CloseAsync(string message, ConnectionCloseReason reason, CancellationToken cancellationToken = default)
Parameters
message
stringA human readable message explaining the close reason.
reason
ConnectionCloseReasonThe message close reason.
cancellationToken
CancellationTokenThe cancellation token.
Returns
CloseAsync(string, int, CancellationToken)
Closes the connection with the client.
ValueTask CloseAsync(string message, int reason, CancellationToken cancellationToken = default)
Parameters
message
stringA human readable message explaining the close reason.
reason
intThe message close reason.
cancellationToken
CancellationTokenThe cancellation token.
Returns
SendAsync(ReadOnlyMemory<byte>, CancellationToken)
Send a message to the client.
ValueTask SendAsync(ReadOnlyMemory<byte> message, CancellationToken cancellationToken = default)
Parameters
message
ReadOnlyMemory<byte>The message.
cancellationToken
CancellationTokenThe cancellation token.
Returns
TryAcceptConnection()
Tries to accept the connection and returns the accepted protocol handler.
Task<IProtocolHandler?> TryAcceptConnection()