Open
Description
Feature Proposal Description
We have amazing gofiber + htmx + sse. We can send partial template on each update via SSE
Example how it can be reached now:
app.Get("/", func (c fiber.Ctx) error {
return c.SendStreamWriter(func(w *bufio.Writer) {
for {
data := getLiveData()
buf := new(bytes.Buffer)
c.App().Config().Views.Render(buf, "my-live-partial-template", data) // hack for partial render
w.WriteString(buf)
time.Sleep(5*time.Second)
}
})
})
I propose that we can add method RenderToWriter(w *bufio.Writer, templateName string, data fiber.Map, layoutName string)
app.Get("/", func (c fiber.Ctx) error {
return c.SendStreamWriter(func(w *bufio.Writer) {
for {
data := getLiveData()
c.RenderToWriter(w, "my-live-partial-template", data)
time.Sleep(5*time.Second)
}
})
})
Alignment with Express API
HTTP RFC Standards Compliance
API Stability
Feature Examples
app.Get("/", func (c fiber.Ctx) error {
return c.SendStreamWriter(func(w *bufio.Writer) {
for {
data := getLiveData()
c.RenderToWriter(w, "my-live-partial-template", data)
time.Sleep(5*time.Second)
}
})
})
Checklist:
- I agree to follow Fiber's Code of Conduct.
- I have searched for existing issues that describe my proposal before opening this one.
- I understand that a proposal that does not meet these guidelines may be closed without explanation.