package main import ( appConfig "bitbucket.org/outfrontmedia/rolling-stock-display-simulation-tool/config" xmppService "bitbucket.org/outfrontmedia/rolling-stock-display-simulation-tool/services" "log" "time" ) func main() { // LOAD APPLICATION CONFIGURATION appConfig.Load() // Initialise XMPP service xmppService.Init() // Send online presence stanza xmppServiceInstance := xmppService.Instance() for { for _, xmppClient := range xmppServiceInstance.XMPPClients { // Send online presence stanza in go rutines go func(xmppClient xmppService.XMPPClient) { err := xmppService.SendOnlinePresenceStanza(xmppClient.Client, xmppClient.Config.Jid) if err != nil { log.Printf("There was an error while sending online presence stanza %v", err) return } }(xmppClient) } // Delay before sending another message time.Sleep(time.Duration(appConfig.AppConfig.GeneralOptions.PresenceStatusDelay * 1000000000)) } }