Streaming API with Skuid

  • 3
  • Question
  • Updated 2 years ago
  • Answered
Hello,

We are trying to leverage the Salesforce Streaming API to get updates to pages in real time. The way we want this to work is to have the page subscribe to a PushTopic on page load, then when the page receives a notification from the Streaming API, requery some of the page models to reflect the change in the data. This will all be done in JavaScript.

The issue we are running into is that when the page tries to subscribe to a PushTopic, we are getting the error "XMLHttpRequest cannot load https://c.na28.visual.force.com/cometd/24.0/. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://skuid.na28.visual.force.com' is therefore not allowed access. The response had HTTP status code 405."

We looked into trying to make a CORS request between the different domains, but it is resulting in the same error.

Has anyone else tried using the Streaming API in this way? Is there a workaround to the cross-domain issues?
Photo of Joe Dobbels

Joe Dobbels

  • 546 Points 500 badge 2x thumb

Posted 2 years ago

  • 3
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Joe,

Have you seen this post?

Real Time Dashboards with Skuid

This is an alternative approach that can get you updates in near real-time (the threshold is configurable by you), does not use the Streaming API, and thereby is not subject to nor consumes any Salesforce Streaming API calls.
Photo of Joe Dobbels

Joe Dobbels

  • 546 Points 500 badge 2x thumb
Thanks Zach,

We have decided that the Streaming API is the way to go for what we want. Do you have any experience using it or do you know of any resources that may help?