Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 639 Bytes

README.md

File metadata and controls

25 lines (18 loc) · 639 Bytes

sse

Middleware sse provides Server-Sent Events to channels binding for Macaron.

Installation

go get github.com/go-macaron/sockets

Usage

Have a look into the example directory to get a feeling for how to use the sse package.

This package essentially provides a binding of Server-Sent Event to channels, which you can use as in the following, contrived example:

m.Get("/stat", sse.Handler(stat{}), func(msg chan<- *stat) {
    for {
        select {
        case <-time.Tick(1 * time.Second):
            msg <- getStat()
        }
    }
})