func (codec JSONP) Decode(reader io.Reader) (packet.Payload, error) {
	data, err := ioutil.ReadAll(reader)

	if err != nil {
		return nil, err
	}

	if len(data) < 2 {
		return nil, errors.New("invalid form data")
	}

	query, err := url.QueryUnescape(string(data[2:]))

	if err != nil {
		return nil, err
	}

	buffer := bytes.NewBufferString(codec.unescape(query))

	return codec.delegate.Decode(buffer)
}
// Decode decodes payload of packets
Decode decodes payload of packets
// Decode decodes payload of packets
func (codec JSONP) Decode(reader io.Reader) (packet.Payload, error) {
	data, err := ioutil.ReadAll(reader)
	if err != nil {
		return nil, err
	}
	if len(data) < 2 {
		return nil, errors.New("invalid form data")
	}
	query, err := url.QueryUnescape(string(data[2:]))
	if err != nil {
		return nil, err
	}
	buffer := bytes.NewBufferString(codec.unescape(query))
	return codec.delegate.Decode(buffer)
}
func ( codec JSONP ) Decode ( reader io . Reader ) ( packet . Payload , error ) { data , err := ioutil . ReadAll ( reader ) if err != nil { return nil , err } if len ( data ) < 2 { return nil , errors . New ( " " ) } query , err := url . QueryUnescape ( string ( data [ 2 : ] ) ) if err != nil { return nil , err } buffer := bytes . NewBufferString ( codec . unescape ( query ) ) return codec . delegate . Decode ( buffer ) }
Decode decodes payload of packets
Decode decodes payload of packets