Class ServerCallContext
Context for a server-side call.
Inheritance
Inherited Members
Namespace: Grpc.Core
Assembly: Grpc.Core.dll
Syntax
public class ServerCallContext
Properties
AuthContext
Gets the AuthContext associated with this call.
Note: Access to AuthContext is an experimental API that can change without any prior notice.
Declaration
public AuthContext AuthContext { get; }
Property Value
| Type | Description |
|---|---|
| AuthContext |
CancellationToken
Cancellation token signals when call is cancelled.
Declaration
public CancellationToken CancellationToken { get; }
Property Value
| Type | Description |
|---|---|
| System.Threading.CancellationToken |
Deadline
Deadline for this RPC.
Declaration
public DateTime Deadline { get; }
Property Value
| Type | Description |
|---|---|
| System.DateTime |
Host
Name of host called in this RPC.
Declaration
public string Host { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Method
Name of method called in this RPC.
Declaration
public string Method { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Peer
Address of the remote endpoint in URI format.
Declaration
public string Peer { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
RequestHeaders
Initial metadata sent by client.
Declaration
public Metadata RequestHeaders { get; }
Property Value
| Type | Description |
|---|---|
| Metadata |
ResponseTrailers
Trailers to send back to client after RPC finishes.
Declaration
public Metadata ResponseTrailers { get; }
Property Value
| Type | Description |
|---|---|
| Metadata |
Status
Status to send back to client after RPC finishes.
Declaration
public Status Status { get; set; }
Property Value
| Type | Description |
|---|---|
| Status |
WriteOptions
Allows setting write options for the following write. For streaming response calls, this property is also exposed as on IServerStreamWriter for convenience. Both properties are backed by the same underlying value.
Declaration
public WriteOptions WriteOptions { get; set; }
Property Value
| Type | Description |
|---|---|
| WriteOptions |
Methods
CreatePropagationToken(ContextPropagationOptions)
Creates a propagation token to be used to propagate call context to a child call.
Declaration
public ContextPropagationToken CreatePropagationToken(ContextPropagationOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ContextPropagationOptions | options |
Returns
| Type | Description |
|---|---|
| ContextPropagationToken |
WriteResponseHeadersAsync(Metadata)
Asynchronously sends response headers for the current call to the client. This method may only be invoked once for each call and needs to be invoked
before any response messages are written. Writing the first response message implicitly sends empty response headers if WriteResponseHeadersAsync haven't
been called yet.
Declaration
public Task WriteResponseHeadersAsync(Metadata responseHeaders)
Parameters
| Type | Name | Description |
|---|---|---|
| Metadata | responseHeaders | The response headers to send. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | The task that finished once response headers have been written. |