func (s *PubSubSubscription) Next() (*Message, error) {
	if s.resp.Error != nil {
		return nil, s.resp.Error
	}

	d := json.NewDecoder(s.resp.Output)

	var r struct {
		From     []byte   `json:"from,omitempty"`
		Data     []byte   `json:"data,omitempty"`
		Seqno    []byte   `json:"seqno,omitempty"`
		TopicIDs []string `json:"topicIDs,omitempty"`
	}

	err := d.Decode(&r)
	if err != nil {
		return nil, err
	}

	from, err := peer.IDFromBytes(r.From)
	if err != nil {
		return nil, err
	}
	return &Message{
		From:     from,
		Data:     r.Data,
		Seqno:    r.Seqno,
		TopicIDs: r.TopicIDs,
	}, nil
}
func (s *PubSubSubscription) Next() (*Message, error) {
	if s.resp.Error != nil {
		return nil, s.resp.Error
	}

	d := json.NewDecoder(s.resp.Output)

	var r struct {
		From     []byte   `json:"from,omitempty"`
		Data     []byte   `json:"data,omitempty"`
		Seqno    []byte   `json:"seqno,omitempty"`
		TopicIDs []string `json:"topicIDs,omitempty"`
	}

	err := d.Decode(&r)
	if err != nil {
		return nil, err
	}

	from, err := peer.IDFromBytes(r.From)
	if err != nil {
		return nil, err
	}
	return &Message{
		From:     from,
		Data:     r.Data,
		Seqno:    r.Seqno,
		TopicIDs: r.TopicIDs,
	}, nil
}
func ( s * PubSubSubscription ) Next ( ) ( * Message , error ) { if s . resp . Error != nil { return nil , s . resp . Error } d := json . NewDecoder ( s . resp . Output ) var r struct { From [ ] byte `json:"from,omitempty"` Data [ ] byte `json:"data,omitempty"` Seqno [ ] byte `json:"seqno,omitempty"` TopicIDs [ ] string `json:"topicIDs,omitempty"` } err := d . Decode ( & r ) if err != nil { return nil , err } from , err := peer . IDFromBytes ( r . From ) if err != nil { return nil , err } return & Message { From : from , Data : r . Data , Seqno : r . Seqno , TopicIDs : r . TopicIDs , } , nil }
// Next waits for the next record and returns that.
Next waits for the next record and returns that .