2
0
mirror of https://github.com/FluuxIO/go-xmpp synced 2024-11-17 15:29:37 +00:00
go-xmpp/cmd/xmpp_component/xmpp_component.go

22 lines
338 B
Go
Raw Normal View History

2018-01-11 21:15:54 +00:00
package main
2018-01-12 18:08:47 +00:00
import (
"fmt"
"fluux.io/xmpp"
)
2018-01-11 21:15:54 +00:00
func main() {
2018-01-12 17:14:41 +00:00
component := xmpp.Component{Host: "mqtt.localhost", Secret: "mypass"}
component.Connect("localhost:8888")
2018-01-12 18:08:47 +00:00
for {
_, packet, err := component.ReadPacket()
if err != nil {
2018-01-13 16:46:10 +00:00
fmt.Println("read error", err)
2018-01-12 18:08:47 +00:00
return
}
fmt.Println("Packet received: ", packet)
}
2018-01-11 21:15:54 +00:00
}