title: gobwas/ws Send opPing over net.Conn
body: <p>Can somebody help me understand what am I doing wrong here, all I'm trying to do is write a Ping message over a net.Conn instance (<code>server</code>), and reply back with a Pong which is expected on a net.Conn instance (<code>client</code>).</p>
  
  <p>I have annotated the code with some errors that I receive.</p>
  
  <pre><code>reader.go
  func read(conn net.Conn) {
    for {
          conn.SetReadDeadline(time.Now().Add(2 * time.Second))
          _, op, err := wsutil.ReadClientData(conn)
          if err != nil {
              log.Printf("wsmanager read: %v", err) // read: write pipe: deadline exceeded
              return
          }
          if op != ws.OpPing {
            continue
          }
  
          c.conn.SetWriteDeadline(time.Now().Add(3 * time.Second))
          if err = wsutil.WriteServerMessage(c.conn, ws.OpPong, []byte{}); err != nil {
              log.Printf("wsmanager: send pong error: %v", err)
              return
          }
    }
  }
  
  // reader_test.go
  
       client, server := net.Pipe()
       go read(server) // starts the loop above
       err := wsutil.WriteClientMessage(server, ws.OpPing, []byte{})
       if err != nil {
         t.Fatalf("failed sending pings message %v", err)
       }
       _, op, err := wsutil.ReadServerData(client)
       if err != nil {
           t.Errorf("exp no err, got %v", err)
       }
       if op != ws.OpPong {
         t.Errorf("exp ws.OpPong, got %v", op)
       }
  
  </code></pre>