func (pf *PrivateFeed) Dispatch(msgChan chan *PrivateMsg, errChan chan error) {
	go func(d *json.Decoder, mc chan<- *PrivateMsg, ec chan<- error) {
		var (
			pMsg *PrivateMsg
			err  error
		)
		for {
			pMsg = new(PrivateMsg)
			if err = d.Decode(pMsg); err != nil {
				ec <- err
			}
			msgChan <- pMsg
		}
	}(pf.decoder, msgChan, errChan)
	return
}
Starts reading from the connection and sends data through given channels
package feed
import (
	"encoding/json"
	"github.com/denro/nordnet/util/models"
)
type PrivateFeed struct {
	*Feed
}
func NewPrivateFeed(address string) (*PrivateFeed, error) {
	f, err := newFeed(address)
	if err != nil {
		return nil, err
	}
	return &PrivateFeed{f}, nil
}
type PrivateOrder models.Order
type PrivateTrade models.Trade
type PrivateMsg FeedMsg
func (pm *PrivateMsg) UnmarshalJSON(b []byte) (err error) {
	rawMsg := rawMsg{}  
	if err = json.Unmarshal(b, &rawMsg); err != nil {
		return
	}
	*pm = PrivateMsg{Type: rawMsg.Type}
	switch rawMsg.Type {
	case heartbeatType:
		pm.Data = struct{}{}
	case orderType:
		order := PrivateOrder{}
		if err = json.Unmarshal(rawMsg.Data, &order); err != nil {
			return
		}
		pm.Data = order
	case tradeType:
		trade := PrivateTrade{}
		if err = json.Unmarshal(rawMsg.Data, &trade); err != nil {
			return
		}
		pm.Data = trade
	}
	return
}