forked from antage/eventsource
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc.go
31 lines (27 loc) · 734 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
Package http provides server-sent events for net/http server.
Example:
package main
import (
"gopkg.in/antage/eventsource.v1"
"log"
"net/http"
"strconv"
"time"
)
func main() {
es := eventsource.New(nil, nil)
defer es.Close()
http.Handle("/events", es)
go func() {
id := 1
for {
es.SendEventMessage("tick", "tick-event", strconv.Itoa(id))
id++
time.Sleep(2 * time.Second)
}
}()
log.Fatal(http.ListenAndServe(":8080", nil))
}
*/
package eventsource