Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsorb84/ssefiber
A basic SSE Implementation for Go
https://github.com/jsorb84/ssefiber
Last synced: 3 months ago
JSON representation
A basic SSE Implementation for Go
- Host: GitHub
- URL: https://github.com/jsorb84/ssefiber
- Owner: jsorb84
- License: mit
- Created: 2024-03-14T18:30:53.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-03-15T21:50:35.000Z (8 months ago)
- Last Synced: 2024-07-14T01:33:36.974Z (4 months ago)
- Language: Go
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-fiber - jsorb84/ssefiber - A basic SSE Implementation for Fiber. (⚙️ Middlewares / 🌱 Third Party)
README
# GoFiber + SSE
[![Go Reference](https://pkg.go.dev/badge/github.com/jsorb84/ssefiber.svg)](https://pkg.go.dev/github.com/jsorb84/ssefiber)
My attempt at a basic wrapper to easily allow SSE with a GoFiber application
## Usage
```go
package mainimport (
"github.com/gofiber/fiber/v2"
"github.com/jsorb84/ssefiber"
)func main() {
app := fiber.New(...)
sse := ssefiber.New(app, "/sse")// Create a channel `One`
channelOne := sse.CreateChannel("Channel One", "/one")// Pass some events
go func() {
for i:=10; i<10; i++ {
channelOne.SendEvent("Event Name", "Event Data")
}
}()
app.Listen(":8000")
}```