good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 9b9ebb78 authored by Anmol Sethi's avatar Anmol Sethi
Browse files

Improve dial example

parent b2cc511e
No related branches found
No related tags found
No related merge requests found
......@@ -79,9 +79,9 @@ For a production quality example that shows off the low level API, see the [echo
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
defer cancel()
c, _, err := websocket.Dial(ctx, "ws://localhost:8080")
c, _, err := websocket.Dial(ctx, "ws://localhost:8080", websocket.DialOptions{})
if err != nil {
log.Fatalf("failed to ws dial: %v", err)
return err
}
defer c.Close(websocket.StatusInternalError, "")
......@@ -92,7 +92,7 @@ jc := websocket.JSONConn{
var v interface{}
err = jc.Read(ctx, &v)
if err != nil {
log.Fatalf("failed to read json: %v", err)
return err
}
log.Printf("received %v", v)
......
......@@ -115,7 +115,7 @@ func ExampleDial() {
c, _, err := websocket.Dial(ctx, "ws://localhost:8080", websocket.DialOptions{})
if err != nil {
log.Fatalf("failed to ws dial: %v", err)
return
}
defer c.Close(websocket.StatusInternalError, "")
......@@ -126,7 +126,7 @@ func ExampleDial() {
var v interface{}
err = jc.Read(ctx, &v)
if err != nil {
log.Fatalf("failed to read json: %v", err)
return
}
log.Printf("received %v", v)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment