in bayeux.go [158:177]
func (b *Bayeux) getClientID(ctx context.Context) error {
handshake := `{"channel": "/meta/handshake", "supportedConnectionTypes": ["long-polling"], "version": "1.0"}`
// Stub out clientIDAndCookies for first bayeuxCall
resp, err := b.call(ctx, handshake, b.creds.bayeuxUrl())
if err != nil {
return fmt.Errorf("cannot get client id: %s", err)
}
defer resp.Body.Close()
decoder := json.NewDecoder(resp.Body)
var h BayeuxHandshake
if err := decoder.Decode(&h); err == io.EOF {
return err
} else if err != nil {
return err
}
creds := clientIDAndCookies{h[0].ClientID, resp.Cookies()}
b.id = creds
return nil
}