Files
old-xmpploadtesting/main.go

44 lines
875 B
Go
Raw Normal View History

2021-09-14 19:25:37 +02:00
package main
import (
"log"
"time"
2021-09-14 19:25:37 +02:00
appConfig "github.com/xmpploadtesting/config"
xmppService "github.com/xmpploadtesting/services"
2021-09-14 19:25:37 +02:00
)
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)
2021-09-16 15:45:36 +02:00
return
}
}(xmppClient)
}
// Delay before sending another message
time.Sleep(time.Duration(appConfig.AppConfig.GeneralOptions.DelayBetweenMassages))
}
2021-09-14 19:25:37 +02:00
}