blob: 1ea15059ee14b675f1ee138a0f3c9df24c727be1 [file] [log] [blame]
khenaidoo59ce9dd2019-11-11 13:05:32 -05001// Copyright 2016 The Gorilla WebSocket Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// +build go1.5
6
7package websocket
8
9import "io"
10
11func (c *Conn) read(n int) ([]byte, error) {
12 p, err := c.br.Peek(n)
13 if err == io.EOF {
14 err = errUnexpectedEOF
15 }
16 c.br.Discard(len(p))
17 return p, err
18}