Using Streaming API in Lightning requires disabling In-App Notification and Mobile Push Notifications -- because both of these features use CometD (Streaming API) and you can only have one CometD session going at a time. (Salesforce is working on revising libraries to allow piggy-backing on the same CometD channel, but that's roadmapped for Winter '19).

Streaming API is an elegant alternative to polling, so I really want to use it, BUT... I don't know how much people are using in-app notifications. Is that just for communities? Is it a lot to ask customers to turn off notifications in order to use my app?

My alternative is to use polling, once every 10 seconds, multiplied by the number of users. Does that create an unacceptable burden on the server -- doesn't seem like it, though I'm instinctively averse to polling like this.

  • How real-time does it need to be? It seems to me that you'd be better off polling just once a minute or so instead. – sfdcfox May 3 '18 at 18:47
  • The poll interval needs to be a balance between server burden and responsiveness. It's an SMS texting app, so when you're texting with someone, you don't want to make them wait a minute between responses. I figure the delay will be, on average, half the poll interval. That makes 10-15 seconds seem pretty much real-time, but anything beyond that gets frustrating. – PatMcClellan__c May 3 '18 at 22:22
  • More generally speaking, what are the things you think about when trying to assess server calls (in this case, a simple SOQL query returning 1 object with 10 fields, from a set of records in the hundreds, not tens of thousands.) – PatMcClellan__c May 3 '18 at 22:26
  • What about using in-app notifications or Mobile Push Notifications instead of streaming? Can't you write a trigger to send the notifications you expect through the standard channels? Or maybe via Chatter? I'm just trying to think of ways you can leverage the built-in capabilities, but I've never attempted them myself. – sfdcfox May 3 '18 at 22:40
  • @sfdxfox -- that's exactly what I thought of doing, but the notifications isn't an API -- yet. That's what they say they're writing into the libraries, but not before Winter '19. And to be clear, in-app notifications and push notifications are streaming -- they use the CometD channel. – PatMcClellan__c May 4 '18 at 17:42

Your Answer

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

Browse other questions tagged or ask your own question.