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