5

I am trying to connect to a Push Topic via the Salesforce Streaming API using Python. My application completes the initial handshake correctly, but then fails on the following connect call, with the error: "403::Unknown client".

My messages work as follows:

Handshake Request

{
    "channel":"/meta/handshake",
    "id":"1",
    "supportedConnectionTypes":["long-polling"],
    "version":"1.0",
    "minimumVersion":"1.0"
}

Handshake Response

{
    "channel":"/meta/handshake",
    "clientId":"xxx",
    "version":"1.0",
    "successful":true,
    "minimumVersion":"1.0",
    "id":"1",
    "supportedConnectionTypes":["long-polling"]
}

It's completed the handshake fine. And then...

Connect Request

{
    "channel":"/meta/connect",
    "clientId":"xxx",
    "id":"2",            
    "connectionType":"long-polling"
}

Connect Response

{
    "channel":"/meta/connect",
    "clientId":"xxx",
    "advice":{
        "reconnect":"handshake",
        "interval":500
    },
    "error":"403::Unknown client",
    "successful":false,
    "id":"2"
}

I have seen this issue here: https://success.salesforce.com/issues_view?id=a1p30000000T0F0AAK

And read through the documentation, including: http://www.salesforce.com/developer/docs/api_streaming/Content/DebuggingStreamingAPIApplications.htm

After reading this however, I am no closer to determining what the actual fault or problem is, or how to remedy it.

I have tried a lot of different things and am at a loss at how to get it to work. I am using this Bayeux client library https://github.com/dkmadigan/python-bayeux-client, with some custom amendments to get the authentication working.

Any help would be greatly appreciated.

2

I solved this by ensuring that the cookies returned in the handshake response were included in all other requests.

2

Found an answer, sort of, as of Feb 12, 2018. When you're using Lightning Experience, the system notifications use CometD, which conflicts with any other implementation of CometD -- killing your connection.

The workaround is to go to Setup>Apps>Mobile Apps>Salesforce Notifications and uncheck both boxes there. That now means anyone using the Mobile app for your org won't get notifications.

Rumor has it there's a major Streaming API overhaul coming in Summer '18, which should address this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.