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.
Best Answer
I solved this by ensuring that the cookies returned in the handshake response were included in all other requests.