bigbluebutton-Github/bbb-graphql-middleware/internal/hascli/replayer/replayer.go
2023-04-26 22:03:40 -03:00

20 lines
735 B
Go

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