如何在Go中将Websocket与NewServeMux结合使用?

I got an error message: cannot use websocket.Handler(handler) (type websocket.Handler) as type func(http.ResponseWriter, *http.Request) in argument to mx.HandleFunc

in following code

package main

import (
    "golang.org/x/net/websocket"
    "net/http"
)

func handler(ws *websocket.Conn) {
    // TODO
}
func main() {
    mx := http.NewServeMux()
    mx.HandleFunc("/ws", websocket.Handler(handler)) // error

    http.ListenAndServe("localhost:8888", mx)
}

I believe you should use mx.Handle, not mx.HandleFunc