System.Net.ServerSentEvents 10.0.0

About

System.Net.ServerSentEvents provides the SseParser type, which exposes factory methods for creating parsers for the events in a stream of server-sent events (SSE).

Key Features

  • Parser for server-sent events (SSE)

How to Use

Asynchronously parsing event contents as strings

using HttpClient client = new();
using Stream stream = await client.GetStreamAsync("https://localhost:12345/sse");
await foreach (SseItem<string> item in SseParser.Create(stream).EnumerateAsync())
{
    Console.WriteLine(item.Data);
}

Synchronously parsing event contents as JSON

MemoryStream stream = new(data);
foreach (SseItem<Book> item in SseParser.Create(stream, (eventType, bytes) => JsonSerializer.Deserialize<Book>(bytes)).Enumerate())
{
    Console.WriteLine(item.Data.Author);
}

Main Types

The main types provided by this library are:

  • System.Net.ServerSentEvents.SseParser
  • System.Net.ServerSentEvents.SseParser<T>
  • System.Net.ServerSentEvents.SseItem<T>

Feedback & Contributing

System.Net.ServerSentEvents is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on System.Net.ServerSentEvents.

Packages Downloads
mcpdotnet
.NET library for the Model Context Protocol (MCP)
64
Microsoft.AspNetCore.Http.Connections.Client
Client for ASP.NET Core Connection Handlers This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/4442a188f9200a57635373dcd640893c0e8dcc78
51
Microsoft.AspNetCore.Http.Connections.Client
Client for ASP.NET Core Connection Handlers This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/abc2c7226ff616316cd1e05d76e6c36b49ce06a1
48
Microsoft.AspNetCore.Http.Connections.Client
Client for ASP.NET Core Connection Handlers This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/c70204ae3c91d2b48fa6d9b92b62265f368421b4
50
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
48
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
49
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
50
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
51
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
52
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
53
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
54
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
57
ModelContextProtocol
.NET SDK for the Model Context Protocol (MCP)
59
ModelContextProtocol.Core
Core .NET SDK for the Model Context Protocol (MCP)
50
OpenAI
The official .NET library for the OpenAI service API.
48

https://go.microsoft.com/fwlink/?LinkID=799421

.NET Framework 4.6.2

.NET 8.0

  • No dependencies.

.NET 9.0

  • No dependencies.

.NET 10.0

  • No dependencies.

.NET Standard 2.0

Version Downloads Last updated
10.0.0 50 11/24/2025
10.0.0-rc.2.25502.107 37 10/16/2025
10.0.0-rc.1.25451.107 36 09/12/2025
10.0.0-preview.7.25380.108 40 08/16/2025
10.0.0-preview.6.25358.103 33 07/17/2025
10.0.0-preview.5.25277.114 44 06/09/2025
10.0.0-preview.4.25258.110 39 05/14/2025
10.0.0-preview.3.25171.5 42 04/12/2025
10.0.0-preview.2.25163.2 52 03/23/2025
10.0.0-preview.1.25080.5 44 03/03/2025
9.0.11 27 11/15/2025
9.0.10 35 10/16/2025
9.0.9 32 09/13/2025
9.0.8 46 08/16/2025
9.0.7 34 07/10/2025
9.0.6 50 06/12/2025
9.0.5 45 05/16/2025
9.0.4 46 04/12/2025
9.0.3 48 03/28/2025
9.0.2 39 03/03/2025
9.0.1 46 01/30/2025
9.0.0 56 11/14/2024
9.0.0-rc.2.24473.5 48 11/14/2024
9.0.0-rc.1.24431.7 43 11/14/2024
9.0.0-preview.7.24405.7 49 11/14/2024
9.0.0-preview.6.24327.7 46 11/14/2024