Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(132)

Side by Side Diff: src/pkg/websocket/client.go

Issue 224087: code review 224087: strings.Bytes -> []byte for documentation example, src/... (Closed)
Patch Set: code review 224087: strings.Bytes -> []byte for documentation example, src/... Created 15 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/compress/zlib/reader.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package websocket 5 package websocket
6 6
7 import ( 7 import (
8 "bufio" 8 "bufio"
9 "http" 9 "http"
10 "io" 10 "io"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 import ( 50 import (
51 "websocket" 51 "websocket"
52 "strings" 52 "strings"
53 ) 53 )
54 54
55 func main() { 55 func main() {
56 ws, err := websocket.Dial("ws://localhost/ws", "", "http://local host/"); 56 ws, err := websocket.Dial("ws://localhost/ws", "", "http://local host/");
57 if err != nil { 57 if err != nil {
58 panic("Dial: ", err.String()) 58 panic("Dial: ", err.String())
59 } 59 }
60 » » if _, err := ws.Write(strings.Bytes("hello, world!\n")); err != nil { 60 » » if _, err := ws.Write([]byte("hello, world!\n")); err != nil {
61 panic("Write: ", err.String()) 61 panic("Write: ", err.String())
62 } 62 }
63 var msg = make([]byte, 512); 63 var msg = make([]byte, 512);
64 if n, err := ws.Read(msg); err != nil { 64 if n, err := ws.Read(msg); err != nil {
65 panic("Read: ", err.String()) 65 panic("Read: ", err.String())
66 } 66 }
67 // use msg[0:n] 67 // use msg[0:n]
68 } 68 }
69 */ 69 */
70 func Dial(url, protocol, origin string) (ws *Conn, err os.Error) { 70 func Dial(url, protocol, origin string) (ws *Conn, err os.Error) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 ws_protocol, found := resp.Header["Websocket-Protocol"] 127 ws_protocol, found := resp.Header["Websocket-Protocol"]
128 if !found { 128 if !found {
129 return ErrNoWebSocketProtocol 129 return ErrNoWebSocketProtocol
130 } 130 }
131 if ws_protocol != protocol { 131 if ws_protocol != protocol {
132 return ErrBadWebSocketProtocol 132 return ErrBadWebSocketProtocol
133 } 133 }
134 } 134 }
135 return 135 return
136 } 136 }
OLDNEW
« no previous file with comments | « src/pkg/compress/zlib/reader.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b