22 lines
296 B
Go
22 lines
296 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"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) {
|
||
|
log.Printf(string(m.Payload))
|
||
|
})
|
||
|
for {
|
||
|
time.Sleep(time.Second)
|
||
|
}
|
||
|
}
|