public ServerSentEventsServiceBenchmarks() { _serverSentEventsClient = new ServerSentEventsClient(Guid.NewGuid(), new ClaimsPrincipal(), new NoOpHttpResponse()); _serverSentEventsService = new ServerSentEventsService(); for (int i = 0; i < MULTIPLE_CLIENTS_COUNT; i++) { _serverSentEventsService.AddClient(new ServerSentEventsClient(Guid.NewGuid(), new ClaimsPrincipal(), new NoOpHttpResponse())); } }
public SseController(ILogger <SseController> logger, ServerSentEventsService serverSentEventsService) { _logger = logger; _serverSentEventsService = serverSentEventsService; }
/// <summary> /// Adds the middleware which provides support for Server-Sent Events protocol to the branch of pipeline with custom service. /// </summary> /// <param name="app">The pipeline builder.</param> /// <param name="pathMatch">The request path to match.</param> /// <param name="serverSentEventsService">The custom service.</param> /// <returns>The pipeline builder.</returns> public static IApplicationBuilder MapServerSentEvents(this IApplicationBuilder app, PathString pathMatch, ServerSentEventsService serverSentEventsService) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (serverSentEventsService == null) { throw new ArgumentNullException(nameof(serverSentEventsService)); } return(app.Map(pathMatch, branchedApp => branchedApp.UseMiddleware <ServerSentEventsMiddleware>(serverSentEventsService))); }
/// <summary> /// Adds the middleware which provides support for Server-Sent Events protocol to the pipeline with custom service. /// </summary> /// <param name="app">The pipeline builder.</param> /// <param name="serverSentEventsService">The custom service.</param> /// <returns>The pipeline builder.</returns> public static IApplicationBuilder UseServerSentEvents(this IApplicationBuilder app, ServerSentEventsService serverSentEventsService) { if (app == null) { throw new ArgumentNullException(nameof(app)); } if (serverSentEventsService == null) { throw new ArgumentNullException(nameof(serverSentEventsService)); } return(app.UseMiddleware <ServerSentEventsMiddleware>(serverSentEventsService)); }
public ServerSentEventsMiddleware(RequestDelegate next, ServerSentEventsService serverSentEventsService) { _next = next; _serverSentEventsService = serverSentEventsService; }
public ChatController(ServerSentEventsService serverSentEventsService) { this.serverSentEventsService = serverSentEventsService; }