22 lines
307 B
Go
22 lines
307 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"simplemq/lib/client"
|
|
"time"
|
|
)
|
|
|
|
func main() {
|
|
c, err := client.New("ws://localhost:8080/ws")
|
|
if err != nil {
|
|
panic(err.Error())
|
|
}
|
|
for {
|
|
err = c.Pub("a", []byte("A:"+time.Now().String()))
|
|
if err != nil {
|
|
log.Printf(err.Error())
|
|
}
|
|
time.Sleep(time.Second)
|
|
}
|
|
}
|