4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 06:19:23 +00:00

Update vendor, move to labstack/echo/v4 Fixes #698

This commit is contained in:
Wim
2019-01-31 17:06:36 +01:00
parent f8a1ab4622
commit c81c0dd22a
265 changed files with 32014 additions and 7207 deletions

View File

@ -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)
}
}