diff --git a/services/xmppsService.go b/services/xmppsService.go index 5448082..572a8dc 100644 --- a/services/xmppsService.go +++ b/services/xmppsService.go @@ -12,7 +12,8 @@ import ( "gosrc.io/xmpp/stanza" ) -const rolingStockPresenceMessage = `ROLLING STOCK PRESENCE MESSAGE\n +{ +const rolingStockPresenceMessage = `ROLLING STOCK PRESENCE MESSAGE\n +{ "serial": "79101X02Y0029450001CJ2000", "model": "VEN032FSNWM00", "displayOrientation": "left", @@ -36,8 +37,7 @@ const rolingStockPresenceMessage = `ROLLING STOCK PRESENCE MESSAGE\n +{ "architecture": "x86-64" }, "digiID": "digi-00000000-00000000-0040FFFF-FF801D30" - } - ` +}` // XMPPService - struct containing type XMPPService struct { @@ -128,7 +128,10 @@ func handleMessage(s xmpp.Sender, p stanza.Packet) { _, _ = fmt.Fprintf(os.Stdout, "Body = %s - from = %s\n", msg.Body, msg.From) reply := stanza.Message{Attrs: stanza.Attrs{To: msg.From}, Body: `{"status": "OK"}`} err := s.Send(reply) - log.Printf("Error sending message %v", err) + + if err != nil { + log.Printf("Error sending to %v message %v", msg.From, err) + } } func errorHandler(err error) {