1st ver
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"simplemq/lib/client"
|
||||
"simplemq/lib/types"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
c, err := client.New("ws://localhost:8080/ws")
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
c.Sub("a", func(m *types.Msg) {
|
||||
ret := fmt.Sprintf("Got %s at %s", string(m.Payload), time.Now().String())
|
||||
log.Printf(ret)
|
||||
c.RpcReply(m, []byte(ret))
|
||||
})
|
||||
for {
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user