mirror of
https://github.com/amitbet/vncproxy.git
synced 2025-09-21 17:39:28 +00:00
general refactoring + fixed setcursorpseudo
This commit is contained in:
@@ -15,17 +15,9 @@ type WsServer struct {
|
||||
|
||||
type WsHandler func(io.ReadWriter, *ServerConfig, string)
|
||||
|
||||
// func checkOrigin(config *websocket.Config, req *http.Request) (err error) {
|
||||
// config.Origin, err = websocket.Origin(config, req)
|
||||
// if err == nil && config.Origin == nil {
|
||||
// return fmt.Errorf("null origin")
|
||||
// }
|
||||
// return err
|
||||
// }
|
||||
|
||||
// This example demonstrates a trivial echo server.
|
||||
func (wsServer *WsServer) Listen(urlStr string, handlerFunc WsHandler) {
|
||||
//http.Handle("/", websocket.Handler(EchoHandler))
|
||||
|
||||
if urlStr == "" {
|
||||
urlStr = "/"
|
||||
}
|
||||
@@ -34,17 +26,6 @@ func (wsServer *WsServer) Listen(urlStr string, handlerFunc WsHandler) {
|
||||
logger.Errorf("error while parsing url: ", err)
|
||||
}
|
||||
|
||||
// http.HandleFunc(url.Path,
|
||||
// func(w http.ResponseWriter, req *http.Request) {
|
||||
// sessionId := req.URL.Query().Get("sessionId")
|
||||
// s := websocket.Server{Handshake: checkOrigin, Handler: websocket.Handler(
|
||||
// func(ws *websocket.ServerConn) {
|
||||
// ws.PayloadType = websocket.BinaryFrame
|
||||
// handlerFunc(ws, wsServer.cfg, sessionId)
|
||||
// })}
|
||||
// s.ServeHTTP(w, req)
|
||||
// })
|
||||
|
||||
http.Handle(url.Path, websocket.Handler(
|
||||
func(ws *websocket.Conn) {
|
||||
path := ws.Request().URL.Path
|
||||
|
Reference in New Issue
Block a user