Class ServerSentEventsMiddlewareExtensions
Provides extensions for registering middleware which provides support for Server-Sent Events protocol.
Inheritance
Inherited Members
Namespace: Lib.AspNetCore.ServerSentEvents
Assembly: Lib.AspNetCore.ServerSentEvents.dll
Syntax
public static class ServerSentEventsMiddlewareExtensions
Methods
AddDistributedServerSentEventsNoReconnectClientsIdsStore(IServiceCollection)
Registers implementation of IServerSentEventsNoReconnectClientsIdsStore backed by an Microsoft.Extensions.Caching.Distributed.IDistributedCache.
Declaration
public static IServiceCollection AddDistributedServerSentEventsNoReconnectClientsIdsStore(this IServiceCollection services)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | services | The collection of service descriptors. |
Returns
Type | Description |
---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | The collection of service descriptors. |
AddInMemoryServerSentEventsNoReconnectClientsIdsStore(IServiceCollection)
Registers implementation of IServerSentEventsNoReconnectClientsIdsStore backed by memory store.
Declaration
public static IServiceCollection AddInMemoryServerSentEventsNoReconnectClientsIdsStore(this IServiceCollection services)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | services | The collection of service descriptors. |
Returns
Type | Description |
---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | The collection of service descriptors. |
AddServerSentEvents(IServiceCollection)
Registers default service which provides operations over Server-Sent Events protocol.
Declaration
public static IServiceCollection AddServerSentEvents(this IServiceCollection services)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | services | The collection of service descriptors. |
Returns
Type | Description |
---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | The collection of service descriptors. |
AddServerSentEvents(IServiceCollection, Action<ServerSentEventsServiceOptions<ServerSentEventsService>>)
Registers default service which provides operations over Server-Sent Events protocol.
Declaration
public static IServiceCollection AddServerSentEvents(this IServiceCollection services, Action<ServerSentEventsServiceOptions<ServerSentEventsService>> configureOptions)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | services | The collection of service descriptors. |
System.Action<ServerSentEventsServiceOptions<ServerSentEventsService>> | configureOptions | A delegate to configure the ServerSentEventsServiceOptions. |
Returns
Type | Description |
---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | The collection of service descriptors. |
AddServerSentEvents<TIServerSentEventsService, TServerSentEventsService>(IServiceCollection)
Registers custom service which provides operations over Server-Sent Events protocol.
Declaration
public static IServiceCollection AddServerSentEvents<TIServerSentEventsService, TServerSentEventsService>(this IServiceCollection services)
where TIServerSentEventsService : class, IServerSentEventsService where TServerSentEventsService : ServerSentEventsService, TIServerSentEventsService
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | services | The collection of service descriptors. |
Returns
Type | Description |
---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | The collection of service descriptors. |
Type Parameters
Name | Description |
---|---|
TIServerSentEventsService | The type of service contract. |
TServerSentEventsService | The type of service implementation. |
AddServerSentEvents<TIServerSentEventsService, TServerSentEventsService>(IServiceCollection, Action<ServerSentEventsServiceOptions<TServerSentEventsService>>)
Registers custom service which provides operations over Server-Sent Events protocol.
Declaration
public static IServiceCollection AddServerSentEvents<TIServerSentEventsService, TServerSentEventsService>(this IServiceCollection services, Action<ServerSentEventsServiceOptions<TServerSentEventsService>> configureOptions)
where TIServerSentEventsService : class, IServerSentEventsService where TServerSentEventsService : ServerSentEventsService, TIServerSentEventsService
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | services | The collection of service descriptors. |
System.Action<ServerSentEventsServiceOptions<TServerSentEventsService>> | configureOptions | A delegate to configure the ServerSentEventsServiceOptions. |
Returns
Type | Description |
---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | The collection of service descriptors. |
Type Parameters
Name | Description |
---|---|
TIServerSentEventsService | The type of service contract. |
TServerSentEventsService | The type of service implementation. |
AddServerSentEventsClientIdProvider<TServerSentEventsClientIdProvider>(IServiceCollection)
Registers implementation of IServerSentEventsClientIdProvider.
Declaration
public static IServiceCollection AddServerSentEventsClientIdProvider<TServerSentEventsClientIdProvider>(this IServiceCollection services)
where TServerSentEventsClientIdProvider : class, IServerSentEventsClientIdProvider
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | services | The collection of service descriptors. |
Returns
Type | Description |
---|---|
Microsoft.Extensions.DependencyInjection.IServiceCollection | The collection of service descriptors. |
Type Parameters
Name | Description |
---|---|
TServerSentEventsClientIdProvider | The type of IServerSentEventsClientIdProvider implementation. |
MapServerSentEvents(IApplicationBuilder, PathString)
Adds the middleware which provides support for Server-Sent Events protocol to the branch of pipeline with default service.
Declaration
public static IApplicationBuilder MapServerSentEvents(this IApplicationBuilder app, PathString pathMatch)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | app | The pipeline builder. |
Microsoft.AspNetCore.Http.PathString | pathMatch | The request path to match. |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | The pipeline builder. |
MapServerSentEvents(IApplicationBuilder, PathString, ServerSentEventsOptions)
Adds the middleware which provides support for Server-Sent Events protocol to the branch of pipeline with default service.
Declaration
public static IApplicationBuilder MapServerSentEvents(this IApplicationBuilder app, PathString pathMatch, ServerSentEventsOptions options)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | app | The pipeline builder. |
Microsoft.AspNetCore.Http.PathString | pathMatch | The request path to match. |
ServerSentEventsOptions | options | The options. |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | The pipeline builder. |
MapServerSentEvents<TServerSentEventsService>(IApplicationBuilder, PathString)
Adds the middleware which provides support for Server-Sent Events protocol to the branch of pipeline with custom service.
Declaration
public static IApplicationBuilder MapServerSentEvents<TServerSentEventsService>(this IApplicationBuilder app, PathString pathMatch)
where TServerSentEventsService : ServerSentEventsService
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | app | The pipeline builder. |
Microsoft.AspNetCore.Http.PathString | pathMatch | The request path to match. |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | The pipeline builder. |
Type Parameters
Name | Description |
---|---|
TServerSentEventsService | The type of custom ServerSentEventsService. |
MapServerSentEvents<TServerSentEventsService>(IApplicationBuilder, PathString, ServerSentEventsOptions)
Adds the middleware which provides support for Server-Sent Events protocol to the branch of pipeline with custom service.
Declaration
public static IApplicationBuilder MapServerSentEvents<TServerSentEventsService>(this IApplicationBuilder app, PathString pathMatch, ServerSentEventsOptions options)
where TServerSentEventsService : ServerSentEventsService
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | app | The pipeline builder. |
Microsoft.AspNetCore.Http.PathString | pathMatch | The request path to match. |
ServerSentEventsOptions | options | The options. |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | The pipeline builder. |
Type Parameters
Name | Description |
---|---|
TServerSentEventsService | The type of custom ServerSentEventsService. |
UseServerSentEvents(IApplicationBuilder)
Adds the middleware which provides support for Server-Sent Events protocol to the pipeline with default service.
Declaration
public static IApplicationBuilder UseServerSentEvents(this IApplicationBuilder app)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | app | The pipeline builder. |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | The pipeline builder. |
UseServerSentEvents(IApplicationBuilder, ServerSentEventsOptions)
Adds the middleware which provides support for Server-Sent Events protocol to the pipeline with default service.
Declaration
public static IApplicationBuilder UseServerSentEvents(this IApplicationBuilder app, ServerSentEventsOptions options)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | app | The pipeline builder. |
ServerSentEventsOptions | options | The options. |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | The pipeline builder. |
UseServerSentEvents<TServerSentEventsService>(IApplicationBuilder)
Adds the middleware which provides support for Server-Sent Events protocol to the pipeline with custom service.
Declaration
public static IApplicationBuilder UseServerSentEvents<TServerSentEventsService>(this IApplicationBuilder app)
where TServerSentEventsService : ServerSentEventsService
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | app | The pipeline builder. |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | The pipeline builder. |
Type Parameters
Name | Description |
---|---|
TServerSentEventsService | The type of custom ServerSentEventsService. |
UseServerSentEvents<TServerSentEventsService>(IApplicationBuilder, ServerSentEventsOptions)
Adds the middleware which provides support for Server-Sent Events protocol to the pipeline with custom service.
Declaration
public static IApplicationBuilder UseServerSentEvents<TServerSentEventsService>(this IApplicationBuilder app, ServerSentEventsOptions options)
where TServerSentEventsService : ServerSentEventsService
Parameters
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | app | The pipeline builder. |
ServerSentEventsOptions | options | The options. |
Returns
Type | Description |
---|---|
Microsoft.AspNetCore.Builder.IApplicationBuilder | The pipeline builder. |
Type Parameters
Name | Description |
---|---|
TServerSentEventsService | The type of custom ServerSentEventsService. |