diff options
author | Wim <wim@42.be> | 2019-01-31 17:06:36 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2019-01-31 17:06:36 +0100 |
commit | c81c0dd22a7779148c4890cfd4bbf490054f06f1 (patch) | |
tree | 06ce6fcdc8f3a2278a2f3050ba42088dd2e64485 /bridge/api/api.go | |
parent | f8a1ab4622a5b833282e9ee42f382451d17c1a06 (diff) | |
download | matterbridge-msglm-c81c0dd22a7779148c4890cfd4bbf490054f06f1.tar.gz matterbridge-msglm-c81c0dd22a7779148c4890cfd4bbf490054f06f1.tar.bz2 matterbridge-msglm-c81c0dd22a7779148c4890cfd4bbf490054f06f1.zip |
Update vendor, move to labstack/echo/v4 Fixes #698
Diffstat (limited to 'bridge/api/api.go')
-rw-r--r-- | bridge/api/api.go | 22 |
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) } } |