예제 #1
0
        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()));
            }
        }
예제 #2
0
 public SseController(ILogger <SseController> logger, ServerSentEventsService serverSentEventsService)
 {
     _logger = logger;
     _serverSentEventsService = serverSentEventsService;
 }
예제 #3
0
 /// <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)));
 }
예제 #4
0
 /// <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;
 }