func NewXHRSession(opts *DialOptions) (*XHRSession, error) {
	cfg := config.New()
	cfg.XHR = opts.client()
	return DialXHR(opts.BaseURL, cfg)
}
NewXHRSession returns a new XHRSession, a SockJS client which supports xhr-polling:

http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html#section-74

Deprecated: Use DialXHR instead.
package sockjsclient
import (
	"bufio"
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"net/http"
	"sync"
	"time"
	"github.com/koding/kite/config"
	"github.com/koding/kite/utils"
	"github.com/igm/sockjs-go/sockjs"
)
var ErrPollTimeout = errors.New("polling on XHR response has timed out")
var errAborted = errors.New("session aborted by server")
type XHRSession struct {
	mu sync.Mutex
	client     *http.Client
	timeout    time.Duration
	sessionURL string
	sessionID  string
	messages   []string
	abort      chan struct{}
	req        *http.Request
	state      sockjs.SessionState
}
var _ sockjs.Session = (*XHRSession)(nil)
func DialXHR(uri string, cfg *config.Config) (*XHRSession, error) {
	serverID := threeDigits()
	sessionID := utils.RandomString(20)
	sessionURL := uri + "/" + serverID + "/" + sessionID
	sessionResp, err := cfg.XHR.Post(sessionURL+"/xhr", "text/plain", nil)
	if err != nil {
		return nil, err
	}
	defer sessionResp.Body.Close()
	if sessionResp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("Starting new session failed. Want: %d Got: %d",
			http.StatusOK, sessionResp.StatusCode)
	}
	frame, err := newFrameReader(sessionResp.Body, cfg.Timeout).ReadByte()
	if err != nil {
		return nil, err
	}
	if frame != 'o' {
		return nil, fmt.Errorf("can't start session, invalid frame: %s", string(frame))
	}
	return &XHRSession{
		client:     cfg.XHR,
		timeout:    cfg.Timeout,
		sessionID:  sessionID,
		sessionURL: sessionURL,
		state:      sockjs.SessionActive,
		abort:      make(chan struct{}, 1),
	}, nil
}