MCPcopy
hub / github.com/gorilla/websocket / ReadJSON

Method ReadJSON

json.go:49–60  ·  json.go::Conn.ReadJSON

ReadJSON reads the next JSON-encoded message from the connection and stores it in the value pointed to by v. See the documentation for the encoding/json Unmarshal function for details about the conversion of JSON to a Go value.

(v interface{})

Source from the content-addressed store, hash-verified

47// See the documentation for the encoding/json Unmarshal function for details
48// about the conversion of JSON to a Go value.
49func (c *Conn) ReadJSON(v interface{}) error {
50 _, r, err := c.NextReader()
51 if err != nil {
52 return err
53 }
54 err = json.NewDecoder(r).Decode(v)
55 if err == io.EOF {
56 // One value is expected in the message.
57 err = io.ErrUnexpectedEOF
58 }
59 return err
60}

Callers 3

TestJSONFunction · 0.80
TestPartialJSONReadFunction · 0.80
ReadJSONFunction · 0.80

Calls 1

NextReaderMethod · 0.95

Tested by 2

TestJSONFunction · 0.64
TestPartialJSONReadFunction · 0.64