general refactoring + fixed setcursorpseudo

This commit is contained in:
amit bezalel
2017-07-20 02:01:40 +03:00
parent 662e8393e9
commit 2d87ae5773
38 changed files with 1082 additions and 1381 deletions

View File

@@ -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