Skip to content

Commit a339da2

Browse files
committed
[v2.0.0] Lib.AspNetCore.ServerSentEvents
1 parent e969fb0 commit a339da2

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## Lib.AspNetCore.ServerSentEvents 2.0.0
2+
### Additions and Changes
3+
- Upgraded to .NET Standard 2.0 and ASP.NET Core 2.0.
4+
- Added generic versions of UseServerSentEvents and MapServerSentEvents.
5+
- Marked obsolete versions of UseServerSentEvents and MapServerSentEvents which take instance of ServerSentEventsService as parameter.
6+
- Added support for keepalives
7+
18
## Lib.AspNetCore.ServerSentEvents 1.3.0
29
### Additions and Changes
310
- General performance improvements.

DocFx.AspNetCore.ServerSentEvents/articles/getting-started.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class Startup
5353
...
5454

5555
app.MapServerSentEvents("/default-sse-endpoint");
56-
app.MapServerSentEvents("/notifications-sse-endpoint", serviceProvider.GetService<NotificationsServerSentEventsService>());
56+
app.MapServerSentEvents<NotificationsServerSentEventsService>("/notifications-sse-endpoint");
5757

5858
...
5959
}
@@ -92,4 +92,28 @@ Server-Sent Events provide auto reconnect and tracking of the last seen message
9292

9393
### Changing Reconnect Interval
9494

95-
The interval after which client attempts to reconnect can be controlled by the application. In order to change the interval for specific endpoint it is enough to call `IServerSentEventsService.ChangeReconnectIntervalAsync`.
95+
The interval after which client attempts to reconnect can be controlled by the application. In order to change the interval for specific endpoint it is enough to call `IServerSentEventsService.ChangeReconnectIntervalAsync`.
96+
97+
## Keepalives
98+
99+
Keepalives are supported in three [modes](../api/Lib.AspNetCore.ServerSentEvents.ServerSentEventsKeepaliveMode.html). By default the will be automatically send if ANCM is detected, but both the mode and interval can be changed per `ServerSentEventsService` type.
100+
101+
```cs
102+
public class Startup
103+
{
104+
public void ConfigureServices(IServiceCollection services)
105+
{
106+
...
107+
108+
services.AddServerSentEvents<INotificationsServerSentEventsService, NotificationsServerSentEventsService>(options =>
109+
{
110+
options.KeepaliveMode = ServerSentEventsKeepaliveMode.Always;
111+
options.KeepaliveInterval = 15;
112+
});
113+
114+
...
115+
}
116+
117+
...
118+
}
119+
```

0 commit comments

Comments
 (0)