func main() { if true { wsBaseURL := fmt.Sprintf("ws://%s:%s/ws/", location.Get("hostname"), location.Get("port")) ws, err := websocket.Dial(wsBaseURL + "rpc/foo") if err != nil { log.Fatal("Dial ", err) return } l := &Listener{} rpc = weeb.NewRpc(ws, l) l.rpc = rpc // go HelloRpcClient(rpc) go rpc.Serve() } if false { fu() } jq().Ready(func() { screenPixelsPerPoint = findScreenPixelsPerPoint() doc.AddEventListeners(document) jqBind(jq(":root")) }) }
func handle_ws(ws *websocket.Conn) { // Gob based RPC requires binary web socket frames. ws.PayloadType = websocket.BinaryFrame l := &Listener{} r := weeb.NewRpc(ws, l) l.rpc = r // go HelloRpcClient(r) err := r.Serve() if err != io.EOF { log.Printf("%v", err) } ws.Close() }