添加视频流接口
This commit is contained in:
parent
0f37e738a7
commit
586356c18a
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -360,7 +361,7 @@ func VideoFeed(c *gin.Context) {
|
||||||
|
|
||||||
// 创建一个通道用于接收客户端连接关闭的信号
|
// 创建一个通道用于接收客户端连接关闭的信号
|
||||||
clientClosed := make(chan struct{})
|
clientClosed := make(chan struct{})
|
||||||
c.Stream(func(w http.ResponseWriter) bool {
|
c.Stream(func(w io.Writer) bool {
|
||||||
// 将读取 Redis 消息通道的逻辑放在这里,方便根据返回值控制循环
|
// 将读取 Redis 消息通道的逻辑放在这里,方便根据返回值控制循环
|
||||||
ch := pubSub.Channel()
|
ch := pubSub.Channel()
|
||||||
for {
|
for {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue