0

I have a streaming server(ffmpeg) that send data through HTTP. I sent the stream to my fiber backend but I only have access to c.body() when the stream server(ffmpeg) is terminated. Is there any way to capture streamed data in real-time in fiber?

here is my sample code:

package main

import "github.com/gofiber/fiber/v2"

func main() {
  app := fiber.New()
  
app.Post("/", func(c *fiber.Ctx) error {
    golang        // real-time reading streamed data in c.body() and send it to fiber websocket
        return c.SendStatus(200)

}
MHM
  • 194
  • 1
  • 9
  • net/http allows this without any problems. You might want to reconsider your choice of HTTP implementation if this turns out to be a problem. – Volker Jun 27 '22 at 19:04
  • is net/http fast as mush as fiber? do you have any example code of it?@Volker – MHM Jun 27 '22 at 19:27
  • net/http is not as fast as fasthttp but you are asking about a streaming solution where speed is limited by the network, not the HTTP implementation. Most people vastly overerstimate how much "perfoemance" they gain by using fasthttp. If your application is 0..7% slower and spends 3% more in GC: Would this really matter? – Volker Jun 27 '22 at 19:44
  • 2
    Have you measured performance problems with `net/http`? The http implementation is rarely the bottleneck. What does it matter if fiber is theoretically faster than some other framework using `net/http` if it's not what you need. – JimB Jun 27 '22 at 19:46

0 Answers0