Skip to content

Instantly share code, notes, and snippets.

@tenntenn
Last active December 9, 2015 19:48
Show Gist options
  • Save tenntenn/4318849 to your computer and use it in GitHub Desktop.
Save tenntenn/4318849 to your computer and use it in GitHub Desktop.
package main
import (
"code.google.com/p/go.net/websocket"
"net/http"
"io"
"log"
)
func echoHandler(ws *websocket.Conn) {
io.Copy(ws, ws)
}
func main() {
http.Handle("/echo", websocket.Handler(echoHandler))
http.Handle("/", http.FileServer(http.Dir(".")))
log.Fatal(http.ListenAndServe(":8080", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment