6 instantiations of SseItem
Microsoft.AspNetCore.Http.Results (1)
ServerSentEventsResult.cs (1)
98yield return new SseItem<T>(item, eventType);
Microsoft.AspNetCore.Http.Results.Tests (3)
ServerSentEventsResultTests.cs (3)
82var events = new[] { new SseItem<string>("event1", "custom-event") }.ToAsyncEnumerable(); 163var events = new[] { new SseItem<TestObject>(testObject) }.ToAsyncEnumerable(); 311var events = new[] { new SseItem<byte[]>(null) }.ToAsyncEnumerable();
System.Net.ServerSentEvents (2)
System\Net\ServerSentEvents\SseParser_1.cs (2)
327sseItem = new SseItem<T>(data, _eventType) { EventId = _eventId, ReconnectionInterval = _nextReconnectionInterval }; 381sseItem = new SseItem<T>(data, _eventType) { EventId = _eventId, ReconnectionInterval = _nextReconnectionInterval };
24 references to SseItem
Microsoft.AspNetCore.Http.Connections.Client (1)
Internal\ServerSentEventsTransport.cs (1)
140await foreach (var item in parser.EnumerateAsync(cancellationToken).ConfigureAwait(false))
Microsoft.AspNetCore.Http.Results (8)
Results.cs (1)
1022public static IResult ServerSentEvents<T>(IAsyncEnumerable<SseItem<T>> values)
ServerSentEventsResult.cs (6)
23private readonly IAsyncEnumerable<SseItem<T>> _events; 33internal ServerSentEventsResult(IAsyncEnumerable<SseItem<T>> events) 55if (_events is IAsyncEnumerable<SseItem<string>> stringEvents) 66private static void FormatSseItem(SseItem<T> item, IBufferWriter<byte> writer, JsonOptions jsonOptions) 94private static async IAsyncEnumerable<SseItem<T>> WrapEvents(IAsyncEnumerable<T> events, string? eventType = null) 107builder.Metadata.Add(new ProducesResponseTypeMetadata(StatusCodes.Status200OK, typeof(SseItem<T>), contentTypes: ["text/event-stream"]));
TypedResults.cs (1)
1112public static ServerSentEventsResult<T> ServerSentEvents<T>(IAsyncEnumerable<SseItem<T>> values)
Microsoft.AspNetCore.Http.Results.Tests (1)
ServerSentEventsResultTests.cs (1)
135Assert.Equal(typeof(SseItem<string>), producesResponseTypeMetadata.Type);
System.Net.ServerSentEvents (14)
System\Net\ServerSentEvents\SseFormatter.cs (6)
27public static Task WriteAsync(IAsyncEnumerable<SseItem<string>> source, Stream destination, CancellationToken cancellationToken = default) 51public static Task WriteAsync<T>(IAsyncEnumerable<SseItem<T>> source, Stream destination, Action<SseItem<T>, IBufferWriter<byte>> itemFormatter, CancellationToken cancellationToken = default) 71private static async Task WriteAsyncCore<T>(IAsyncEnumerable<SseItem<T>> source, Stream destination, Action<SseItem<T>, IBufferWriter<byte>> itemFormatter, CancellationToken cancellationToken) 76await foreach (SseItem<T> item in source.WithCancellation(cancellationToken).ConfigureAwait(false))
System\Net\ServerSentEvents\SseParser.cs (3)
14/// <summary>The default <see cref="SseItem{T}.EventType"/> ("message") for an event that did not explicitly specify a type.</summary> 17/// <summary>Creates a parser for parsing a <paramref name="sseStream"/> of server-sent events into a sequence of <see cref="SseItem{String}"/> values.</summary> 31/// <summary>Creates a parser for parsing a <paramref name="sseStream"/> of server-sent events into a sequence of <see cref="SseItem{T}"/> values.</summary>
System\Net\ServerSentEvents\SseParser_1.cs (5)
96public IEnumerable<SseItem<T>> Enumerate() 131if (ProcessLine(out SseItem<T> sseItem, out int advance)) 176public async IAsyncEnumerable<SseItem<T>> EnumerateAsync([EnumeratorCancellation] CancellationToken cancellationToken = default) 211if (ProcessLine(out SseItem<T> sseItem, out int advance)) 315private bool ProcessLine(out SseItem<T> sseItem, out int advance)