summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'bridge')
-rw-r--r--bridge/api/api.go22
1 files changed, 8 insertions, 14 deletions
diff --git a/bridge/api/api.go b/bridge/api/api.go
index f8a7c04c..9a3f1178 100644
--- a/bridge/api/api.go
+++ b/bridge/api/api.go
@@ -8,8 +8,8 @@ import (
"github.com/42wim/matterbridge/bridge"
"github.com/42wim/matterbridge/bridge/config"
- "github.com/labstack/echo"
- "github.com/labstack/echo/middleware"
+ "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v4/middleware"
"github.com/zfjagann/golang-ring"
)
@@ -117,20 +117,14 @@ func (b *API) handleStream(c echo.Context) error {
return err
}
c.Response().Flush()
- closeNotifier := c.Response().CloseNotify()
for {
- select {
- case <-closeNotifier:
- return nil
- default:
- msg := b.Messages.Dequeue()
- if msg != nil {
- if err := json.NewEncoder(c.Response()).Encode(msg); err != nil {
- return err
- }
- c.Response().Flush()
+ msg := b.Messages.Dequeue()
+ if msg != nil {
+ if err := json.NewEncoder(c.Response()).Encode(msg); err != nil {
+ return err
}
- time.Sleep(200 * time.Millisecond)
+ c.Response().Flush()
}
+ time.Sleep(200 * time.Millisecond)
}
}