From 8d0ba9a0d0d4b490d0cff9839d401a025df0f3d1 Mon Sep 17 00:00:00 2001 From: Pierre PACI Date: Fri, 17 Nov 2017 21:22:27 +0100 Subject: [PATCH] more example in example As this file is an example, it could help people to learn golang pattern. So, i've added another way to get a clock signal. I've kept the original to show people 2 different ways. Former-commit-id: d5b50c0845e93388a41863fb262b166320c2735c --- _examples/websocket/connectionlist/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_examples/websocket/connectionlist/main.go b/_examples/websocket/connectionlist/main.go index 14c399a8..f13bc02f 100644 --- a/_examples/websocket/connectionlist/main.go +++ b/_examples/websocket/connectionlist/main.go @@ -77,7 +77,7 @@ func main() { go func() { i := 0 - for { + for range time.Tick(1*time.Second){ //another way to get clock signal mutex.Lock() broadcast(Conn, fmt.Sprintf("aaaa2 %d\n", i)) mutex.Unlock()