func (b *Bayeux) call(body string, route string) (resp *http.Response, e error) {
	var jsonStr = []byte(body)
	req, err := http.NewRequest("POST", route, bytes.NewBuffer(jsonStr))
	if err != nil {
		logger.Fatalf("Bad Call request: %s", err)
	}
	req.Header.Add("Content-Type", "application/json")
	req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", b.creds.AccessToken))
	for _, cookie := range b.id.cookies {
		req.AddCookie(cookie)
	}
	client := &http.Client{}
	resp, err = client.Do(req)
	if err == io.EOF {
		logger.Printf("Bad bayeuxCall io.EOF: %s\n", err)
		logger.Printf("Bad bayeuxCall Response: %+v\n", resp)
	} else if err != nil {
		e = errors.New(fmt.Sprintf("Unknown error: %s", err))
		logger.Printf("Bad unrecoverable Call: %s", err)
	}
	return resp, e
}
Call is the base function for making bayeux requests
package bayeux
import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net/http"
	"net/url"
	"os"
	"strings"
	"sync"
	"time"
)
type TriggerEvent struct {
	ClientID string `json:"clientId"`
	Data     struct {
		Event struct {
			CreatedDate time.Time `json:"createdDate"`
			ReplayID    int       `json:"replayId"`
			Type        string    `json:"type"`
		} `json:"event"`
		Object json.RawMessage `json:"sobject"`
	} `json:"data,omitempty"`
	Channel    string `json:"channel"`
	Successful bool   `json:"successful,omitempty"`
}
func (t TriggerEvent) topic() string {
	s := strings.Replace(t.Channel, "/topic/", "", 1)
	return s
}
type Status struct {
	connected bool
	clientID  string
	channels  []string
}
type BayeuxHandshake []struct {
	Ext struct {
		Replay bool `json:"replay"`
	} `json:"ext"`
	MinimumVersion           string   `json:"minimumVersion"`
	ClientID                 string   `json:"clientId"`
	SupportedConnectionTypes []string `json:"supportedConnectionTypes"`
	Channel                  string   `json:"channel"`
	Version                  string   `json:"version"`
	Successful               bool     `json:"successful"`
}
type Subscription struct {
	ClientID     string `json:"clientId"`
	Channel      string `json:"channel"`
	Subscription string `json:"subscription"`
	Successful   bool   `json:"successful"`
}
type Credentials struct {
	AccessToken string `json:"access_token"`
	InstanceURL string `json:"instance_url"`
	IssuedAt    int
	ID          string
	TokenType   string `json:"token_type"`
	Signature   string
}
func (c Credentials) bayeuxUrl() string {
	return c.InstanceURL + "/cometd/38.0"
}
type clientIDAndCookies struct {
	clientID string
	cookies  []*http.Cookie
}
type Bayeux struct {
	creds Credentials
	id    clientIDAndCookies
}
var wg sync.WaitGroup
var logger = log.New(os.Stdout, "", log.Ldate|log.Ltime|log.Lmicroseconds|log.Lshortfile)
var status = Status{false, "", []string{}}