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
|
// handle inbound messages on the channel
|
||||||
go readGorillaConn(done, conn)
|
go readGorillaConn(done, conn)
|
||||||
|
|
||||||
ticker := time.NewTicker(time.Second)
|
ticker := time.NewTicker(time.Second * 10)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
@ -85,20 +85,7 @@ func gorillaDial() {
|
||||||
case <-done:
|
case <-done:
|
||||||
return
|
return
|
||||||
case t := <-ticker.C:
|
case t := <-ticker.C:
|
||||||
err := conn.WriteMessage(websocket.TextMessage, []byte(t.String()))
|
log.Println("gorilla NewTicker()", 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
|
|
||||||
}
|
|
||||||
case <-interrupt:
|
case <-interrupt:
|
||||||
log.Println("interrupt")
|
log.Println("interrupt")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue