1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
11 "golang.org/x/net/websocket"
14 // Echo the data received on the WebSocket.
15 func EchoServer(ws *websocket.Conn) {
19 // This example demonstrates a trivial echo server.
20 func ExampleHandler() {
21 http.Handle("/echo", websocket.Handler(EchoServer))
22 err := http.ListenAndServe(":12345", nil)
24 panic("ListenAndServe: " + err.Error())