Skip to content

Commit

Permalink
[v2.0.0] Lib.AspNetCore.ServerSentEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
tpeczek committed Jul 30, 2018
1 parent e969fb0 commit a339da2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## Lib.AspNetCore.ServerSentEvents 2.0.0
### Additions and Changes
- Upgraded to .NET Standard 2.0 and ASP.NET Core 2.0.
- Added generic versions of UseServerSentEvents and MapServerSentEvents.
- Marked obsolete versions of UseServerSentEvents and MapServerSentEvents which take instance of ServerSentEventsService as parameter.
- Added support for keepalives

## Lib.AspNetCore.ServerSentEvents 1.3.0
### Additions and Changes
- General performance improvements.
Expand Down
28 changes: 26 additions & 2 deletions DocFx.AspNetCore.ServerSentEvents/articles/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class Startup
...

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

...
}
Expand Down Expand Up @@ -92,4 +92,28 @@ Server-Sent Events provide auto reconnect and tracking of the last seen message

### Changing Reconnect Interval

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`.
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`.

## Keepalives

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.

```cs
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
...

services.AddServerSentEvents<INotificationsServerSentEventsService, NotificationsServerSentEventsService>(options =>
{
options.KeepaliveMode = ServerSentEventsKeepaliveMode.Always;
options.KeepaliveInterval = 15;
});

...
}

...
}
```

0 comments on commit a339da2

Please sign in to comment.