Skip to main content
I'm trying to connect to the event bus but it never connect.

I have tried different forms of connection, But I never get the handshake and tell me that it is connected.

First get the token asking to /services/oauth2/token, and it give me a token.

After that i try to create a transport and connect using a cometD connection, but it never connect.

Anybody can iluminate me or give me some tips, please.

Here are a cuple of my tests. I'm using C⌗.

Option 1:

            var endpoint = $"https://{Global.salesforceInstance}/cometd/57.0/";    

            var options = new Dictionary<string, object>

            {

                { ClientTransport.TIMEOUT_OPTION, 120000 },

                { ClientTransport.MAX_NETWORK_DELAY_OPTION, 120000 }

            };            

            

            var headers = new NameValueCollection();            

            headers.Add("Authorization", "Bearer " + token);

            var transport = new LongPollingTransport(options, headers);

            bayeuxClient = new BayeuxClient(endpoint, transport);            

            bayeuxClient.Handshake();

            

            bayeuxClient.WaitFor(5000, new List<BayeuxClient.State>() { BayeuxClient.State.CONNECTED });   

            if (bayeuxClient.Handshook)

            {

                channel.Subscribe(subscription);

            }

Option 2:

            var streamingClient = new ResilientStreamingClient(() => tokenResponse, configOptions, loggerResilent);

            streamingClient.Handshake();

            List<IMessageListener> listener = new List<IMessageListener>();

            listener.Add(new CustomMessageListener(loggerListener));

            

            var eventBus = new EventBus(streamingClient, loggerEventBus, resilentForceClient, listener, configOptions);

            // Suscripciones           

            eventBus.Subscribe<CustomMessageListener>(

               new PlatformEvent<CustomMessageListener>()

               {

                   Name = "Low_Ink__e",

                   ReplayId = 1

               });
1 answer
0/9000