You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: read.go
    path of file: ./repos/go-whatsapp
    
    the code of the file until where you have to start completion: package whatsapp

import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"strings"

	"github.com/Rhymen/go-whatsapp/binary"
	"github.com/Rhymen/go-whatsapp/crypto/cbc"
	"github.com/gorilla/websocket"
	"github.com/pkg/errors"
)

func (wac *Conn) readPump() {
	defer func() {
		wac.wg.Done()
		_, _ = wac.Disconnect()
	}()

	var readErr error
	var msgType int
	var reader io.Reader

	for {
		readerFound := make(chan struct{})
		go func() {
			if wac.ws != nil {
				msgType, reader, readErr = wac.ws.conn.NextReader()
			}
			close(readerFound)
		}()
		select {
		case <-readerFound:
			if readErr != nil {
				wac.handle(&ErrConnectionFailed{Err: readErr})
				return
			}

    
func (wac *Conn) readPump() {
	defer func() {
		wac.wg.Done()
		_, _ = wac.Disconnect()
	}()

	var readErr error
	var msgType int
	var reader io.Reader

	for {
		readerFound := make(chan struct{})
		go func() {
			if wac.ws != nil {
				msgType, reader, readErr = wac.ws.conn.NextReader()
			}
			close(readerFound)
		}()
		select {
		case <-readerFound:
			if readErr != nil {
				wac.handle(&ErrConnectionFailed{Err: readErr})
				return
			}
			msg, err := ioutil.ReadAll(reader)
			if err != nil {
				wac.handle(errors.Wrap(err, "error reading message from Reader"))
				continue
			}
			err = wac.processReadData(msgType, msg)
			if err != nil {
				wac.handle(errors.Wrap(err, "error processing data"))
			}
		case <-wac.ws.close:
			return
		}
	}
}