Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Latest commit

 

History

History
17 lines (13 loc) · 644 Bytes

README.md

File metadata and controls

17 lines (13 loc) · 644 Bytes

EvtSource

A .net core client library for server-sent events.

Available from nuget as 3v.EvtSource.

Usage Example

var evt = new EventSourceReader(new Uri("https://example.com/some/url/to/SSE")).Start();
evt.MessageReceived += (object sender, EventSourceMessageEventArgs e) => Console.WriteLine($"{e.Event} : {e.Message}");
evt.Disconnected += async (object sender, DisconnectEventArgs e) => {
    Console.WriteLine($"Retry: {e.ReconnectDelay} - Error: {e.Exception}");
    await Task.Delay(e.ReconnectDelay);
    evt.Start(); // Reconnect to the same URL
};