Websocket with special characters

I am using websocket with client nodejs and server golang (net library) via tcp. I am read data sent from client but many special chars. Some one can help me about that?

Data received:

\u0016\u0003\u0001\u0002\u0000\u0001\u0000\u0001\ufffd\u0003\u0003x\ufffd_\ufffdj\ufffd\ufffd\ufffd\ufffdȬ{\ufffd \ufffdI\u003c9\u000bC1YŲ\ufffdVp\u0017\ufffd\u000e`\ufffd \ufffd\ufffd\ufffd\u0017\ufffd\ufffd=\\u0002\ufffd~,\u0011\ufffdn\ufffd\ufffdY\u0010\ufffd\u001c\ufffdw\u000f\ufffd\ufffd(hfK\ufffd\ufffd\u0000 \u001a\u001a\u0013\u0001\u0013\u0002\u0013\u0003\ufffd+\ufffd/\ufffd,\ufffd0̨̩\ufffd\u0013\ufffd\u0014\u0000\ufffd\u0000\ufffd\u0000/\u00005\u0001\u0000\u0001\ufffd\ufffd\ufffd\u0000\u0000\u0000\u0000\u0000\u0014\u0000\u0012\u0000\u0000\u000fvenus.localhost\u0000\u0017\u0000\u0000\ufffd\u0001\u0000\u0001\u0000\u0000"

This func use to accept tcp

func (s *WebsocketServer) Serve() {
    if s.running {
        return
    }
    s.running = true

    for _, lsn := range s.lsnList {
        for i := 0; i < s.accepts; i++ {
            go func(lsn2 *net.TCPListener) {
                var (
                    conn *net.TCPConn
                    err  error
                )
                for {
                    if conn, err = AcceptTCP(lsn2); err != nil {
                        // if listener close then return
                        log.Error("listener.Accept(\"%s\") error(%v)", lsn2.Addr().String(), err)
                        return
                    }
                    if err = conn.SetKeepAlive(s.c.Keepalive); err != nil {
                        log.Error("conn.SetKeepAlive() error(%v)", err)
                        return
                    }
                    if err = conn.SetReadBuffer(s.c.ReceiveBuf); err != nil {
                        log.Error("conn.SetReadBuffer() error(%v)", err)
                        return
                    }
                    if err = conn.SetWriteBuffer(s.c.SendBuf); err != nil {
                        log.Error("conn.SetWriteBuffer() error(%v)", err)
                        return
                    }

                    go s.establishWebsocketConnection(conn)
                }
            }(lsn)
        }
    }
}

func (s *WebsocketServer) establishWebsocketConnection(conn net.Conn) {
    var (
        // conn2         = NewBufferedConnSize(conn, 66560)
        req           *websocket.Request
        websocketConn *websocket.Conn
        err           error
    )

    rr := bufio.NewReader(conn)
    if req, err = websocket.ReadRequest(rr); err != nil || req.RequestURI != "/apiws" {
        conn.Close()
        if err != io.EOF {
            log.Errorf("websocket.ReadRequest(rr) error(%v)", err)
        }
        return
    } else {
        wr := bufio.NewWriter(conn)
        websocketConn, err = websocket.Upgrade(conn, rr, wr, req)
        if err != nil {
            log.Errorf("websocket.Upgrade(rr) error(%v)", err)
            conn.Close()
            return
        }
    }

    codec, err := NewCodecByName(s.c.ProtoName, websocketConn)
    tcpConn := NewTcpConnection2(s.c.ServerName, websocketConn, s.c.SendChanSize, codec, true, s)

    // log.Info("establishTcpConnection...")
    defer func() {
        if err := recover(); err != nil {
            log.Error("tcp_server handle panic: %v\n%s", err, debug.Stack())
            tcpConn.Close()
        }
    }()

    s.onNewConnection(tcpConn)

    for {
        tcpConn.conn.SetReadDeadline(time.Now().Add(time.Minute * 6))
        msg, err := tcpConn.Receive()
        if err != nil {
            log.Error("conn: %s recv error: %v", tcpConn, err)
            return
        }

        if msg == nil {
            log.Error("recv a nil msg by conn: %s", tcpConn)
            continue
        }

        if s.callback != nil {
            // log.Info("onConnectionDataArrived - conn: %s", conn)
            if err := s.callback.OnConnectionDataArrived(tcpConn, msg); err != nil {
            }
        }
    }
}

Function from websocket file, I print data here like above

func ReadRequest(r *bufio.Reader) (req *Request, err error) {
    var (
        b  []byte
        ok bool
    )
    req = &Request{reader: r}
    if b, err = req.readLine(); err != nil {
        return
    }
    log.Errorf("websocket.ReadRequest: %s", string(b))

    if req.Method, req.RequestURI, req.Proto, ok = parseRequestLine(string(b)); !ok {
        return nil, fmt.Errorf("malformed HTTP request %s", b)
    }
    if req.Header, err = req.readMIMEHeader(); err != nil {
        return
    }
    req.Host = req.Header.Get("Host")
    return req, nil
}

func (r *Request) readLine() ([]byte, error) {
    var line []byte
    for {
        l, more, err := r.reader.ReadLine()
        if err != nil {
            return nil, err
        }
        // Avoid the copy if the first call produced a full line.
        if line == nil && !more {
            return l, nil
        }
        line = append(line, l...)
        if !more {
            break
        }
    }
    return line, nil
}

Please help me

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum