Created
September 3, 2015 10:19
-
-
Save krak3n/06eb8894e93167a8e782 to your computer and use it in GitHub Desktop.
Golang Loop Labels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (p *PerceptorService) Run() { | |
for { | |
conn, _, err := d.Dial(host, headers) | |
if err != nil { | |
fmt.Printf("WS Connection Failure: %s", err) | |
time.Sleep(time.Second) | |
continue | |
} | |
ReadLoop: | |
for { | |
t, m, e := conn.ReadMessage() | |
if e != nil { | |
fmt.Println("Error") | |
conn.Close() | |
break ReadLoop | |
} | |
fmt.Println(t, string(m[:]), e) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment