From dbb09547c10c0762efc107f69bf3f83806f04573 Mon Sep 17 00:00:00 2001 From: t-u-r-b-o-3-0-0-0 Date: Tue, 18 Apr 2023 15:25:07 +0200 Subject: [PATCH] removed iris examples; --- _examples/iris/go.mod | 8 ------- _examples/iris/main.go | 54 ------------------------------------------ 2 files changed, 62 deletions(-) delete mode 100644 _examples/iris/go.mod delete mode 100644 _examples/iris/main.go diff --git a/_examples/iris/go.mod b/_examples/iris/go.mod deleted file mode 100644 index ef1db3e..0000000 --- a/_examples/iris/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module iris_example - -go 1.15 - -require ( - github.com/nfwsncked/go-sse v1.6.0 - github.com/kataras/iris/v12 v12.2.0-alpha2.0.20210127020946-ce25e698f8f8 -) diff --git a/_examples/iris/main.go b/_examples/iris/main.go deleted file mode 100644 index b196b51..0000000 --- a/_examples/iris/main.go +++ /dev/null @@ -1,54 +0,0 @@ -package main - -import ( - "log" - "net/http" - "os" - "strconv" - "time" -) - -func main() { - s := sse.NewServer(&sse.Options{ - // Increase default retry interval to 10s. - RetryInterval: 10 * 1000, - // CORS headers - Headers: map[string]string{ - "Access-Control-Allow-Origin": "*", - "Access-Control-Allow-Methods": "GET, OPTIONS", - "Access-Control-Allow-Headers": "Keep-Alive,X-Requested-With,Cache-Control,Content-Type,Last-Event-ID", - }, - // Custom channel name generator - ChannelNameFunc: func(request *http.Request) string { - return request.URL.Path - }, - // Print debug info - Logger: log.New(os.Stdout, "go-sse: ", log.Ldate|log.Ltime|log.Lshortfile), - }) - - defer s.Shutdown() - - app := iris.New() - app.Get("/", func(ctx iris.Context) { - ctx.ServeFile("../static/index.html") - }) - app.Get("/events/{channel}", iris.FromStd(s)) - - go func() { - for { - s.SendMessage("/events/channel-1", sse.SimpleMessage(time.Now().Format("2006/02/01/ 15:04:05"))) - time.Sleep(5 * time.Second) - } - }() - - go func() { - i := 0 - for { - i++ - s.SendMessage("/events/channel-2", sse.SimpleMessage(strconv.Itoa(i))) - time.Sleep(5 * time.Second) - } - }() - - app.Listen(":3000") -}