The reconcile package is used for DOM reconcilation in Isomorphic Go web applications.

examplehandler_test.go 583B

1234567891011121314151617181920212223242526
  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.
  4. package websocket_test
  5. import (
  6. "io"
  7. "net/http"
  8. "golang.org/x/net/websocket"
  9. )
  10. // Echo the data received on the WebSocket.
  11. func EchoServer(ws *websocket.Conn) {
  12. io.Copy(ws, ws)
  13. }
  14. // This example demonstrates a trivial echo server.
  15. func ExampleHandler() {
  16. http.Handle("/echo", websocket.Handler(EchoServer))
  17. err := http.ListenAndServe(":12345", nil)
  18. if err != nil {
  19. panic("ListenAndServe: " + err.Error())
  20. }
  21. }