ready to do an event response
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
06e60fbcb6
commit
082e717d3d
17
gorilla.go
17
gorilla.go
|
@ -77,7 +77,7 @@ func gorillaDial() {
|
|||
// handle inbound messages on the channel
|
||||
go readGorillaConn(done, conn)
|
||||
|
||||
ticker := time.NewTicker(time.Second)
|
||||
ticker := time.NewTicker(time.Second * 10)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
|
@ -85,20 +85,7 @@ func gorillaDial() {
|
|||
case <-done:
|
||||
return
|
||||
case t := <-ticker.C:
|
||||
err := conn.WriteMessage(websocket.TextMessage, []byte(t.String()))
|
||||
if err != nil {
|
||||
log.Println("write:", err)
|
||||
return
|
||||
}
|
||||
|
||||
msg := pb.CreateSampleEvent()
|
||||
msg.Name = "test echo over gorilla websocket"
|
||||
data, _ := proto.Marshal(msg)
|
||||
err2 := conn.WriteMessage(websocket.BinaryMessage, data)
|
||||
if err2 != nil {
|
||||
log.Println("write:", err2)
|
||||
return
|
||||
}
|
||||
log.Println("gorilla NewTicker()", t.String())
|
||||
case <-interrupt:
|
||||
log.Println("interrupt")
|
||||
|
||||
|
|
Loading…
Reference in New Issue