Table of Contents

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

HttpContext

RequestAborted

Get the request cancellation token.

CancellationToken RequestAborted { get; }

Property Value

CancellationToken

RequestServices

Gets access to the request scoped service provider.

IServiceProvider RequestServices { get; }

Property Value

IServiceProvider

Methods

CloseAsync(string, ConnectionCloseReason, CancellationToken)

Closes the connection with the client.

ValueTask CloseAsync(string message, ConnectionCloseReason reason, CancellationToken cancellationToken = default)

Parameters

message string

A human readable message explaining the close reason.

reason ConnectionCloseReason

The message close reason.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask

CloseAsync(string, int, CancellationToken)

Closes the connection with the client.

ValueTask CloseAsync(string message, int reason, CancellationToken cancellationToken = default)

Parameters

message string

A human readable message explaining the close reason.

reason int

The message close reason.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask

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 CancellationToken

The cancellation token.

Returns

ValueTask

TryAcceptConnection()

Tries to accept the connection and returns the accepted protocol handler.

Task<IProtocolHandler?> TryAcceptConnection()

Returns

Task<IProtocolHandler>