Skip to content

zhangyuezhong/EventSource4Net

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EventSource4Net

EventSource4Net is a eventsource implementation for .Net. By using EventSource4Net can you receive Server-Sent Event(SSE) in your native .Net program.

##Install## EventSource4Net is available as a Nuget-package. From the Package Manager Console enter:

        Install-package EventSource4Net

##How to use?##

It's dead-simple to use.

        EventSource es = new EventSource(new Uri(<Your url>));
        es.StateChanged += new EventHandler<StateChangedEventArgs>((o, e) => { Console.WriteLine("New state: " + e.State.ToString()); });
        es.EventReceived += new EventHandler<ServerSentEventReceivedEventArgs>((o, e) => { Console.WriteLine("--------- Msg received -----------\n" + e.Message.ToString()); });
        es.Start();

See the sample-project!

##Logging## EventSource4Net uses slf4net as a logging facade.

##ToDo##

  • Implement functionallity to cancel the eventsource.

##Contributions## I'll be more than happy to get contributions!!!

About

An eventsource(Server-Sent Events client) implementation for .Net.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%