bigbluebutton-Github/bbb-graphql-middleware/internal/hascli/replayer/replayer.go

20 lines
735 B
Go
Raw Normal View History

2023-04-27 09:03:40 +08:00
package replayer
import (
"github.com/iMDT/bbb-graphql-middleware/internal/common"
log "github.com/sirupsen/logrus"
)
func ReplaySubscriptionStartMessages(hc *common.HasuraConnection, fromBrowserChannel chan interface{}) {
log := log.WithField("_routine", "ReplaySubscriptionStartMessages").WithField("browserConnectionId", hc.Browserconn.Id).WithField("hasuraConnectionId", hc.Id)
hc.Browserconn.ActiveSubscriptionsMutex.Lock()
for _, subscription := range hc.Browserconn.ActiveSubscriptions {
if subscription.LastSeenOnHasuraConnetion != hc.Id {
log.Tracef("replaying subscription start: %v", subscription.Message)
fromBrowserChannel <- subscription.Message
}
}
hc.Browserconn.ActiveSubscriptionsMutex.Unlock()
}