Streamingcomponent
Lightning Component for the Salesforce Streaming API
Install / Use
/learn @afawcett/StreamingcomponentREADME
Streaming API Lightning Component
For more information see here.
<a href="https://githubsfdeploy.herokuapp.com"> <img alt="Deploy to Salesforce" src="https://raw.githubusercontent.com/afawcett/githubsfdeploy/master/deploy.png"> </a>Documentation
This Lightning Component makes it easier to use the Streaming API and thus Platform Events in your Lightning Components. Simply state the channel, e.g. /topic/mytopic or /event/MyEvent__e along with an onMessage handler.
<aura:component implements="flexipage:availableForAllPageTypes">
<aura:attribute name="lastMessagePayload" type="String" access="private"/>
<c:streaming channel="/event/MyEvent__e" onMessage="{!c.handleMessage}"/>
<div>{!v.lastMessagePayload}</div>
</aura:component>
({
handleMessage : function(component, event, helper) {
component.set("v.lastMessagePayload", JSON.stringify(event.getParam("payload")));
}
})
NOTE: This component will work with PushTopic's as well.

Instructions
- Deploy via the button above (to Summer'17 org)
- Create a Platform Event with an API name of MyEvent__e
- Add a field with an API name of Message__c
- Add the StreamingDemo component to a Lightning Page via Lightning App Builder
- Issue the following code from Execute Annonymous
- Observe the message in the Lightning page created above
// Create event to publish
List<MyEvent__e> events = new List<MyEvent__e>();
events.add(new MyEvent__e(Message__c = 'My Message'));
// Call method to publish events
List<Database.SaveResult> results = EventBus.publish(events);
// Inspect publishing result for each event
for (Database.SaveResult sr : results) {
if (sr.isSuccess()) {
System.debug('Successfully published event.');
} else {
for(Database.Error err : sr.getErrors()) {
System.debug('Error returned: ' +
err.getStatusCode() +
err.getMessage());
}
}
}
Related Skills
walmart-sales-analyzer
Analyze Walmart sales data to explore trends between store sales and unemployment rates. Generate insightful visualizations and a beautiful HTML report with deep analysis. Suitable for quick insights into the relationship between sales data and macroeconomic factors.
ditto-sales-enablement
2Claude Code skill: Generate a complete sales enablement kit (battlecard, objection guide, quote bank, one-pager, pitch narrative, ROI framework, demo script) from a single Ditto research study.
dubbl
3A full-featured, open-source alternative to Xero and QuickBooks. It is API-first, developer-friendly, and built for teams that want full control over their financial data.
heroku-agentforce-mcp
3This repository has 4 different MCP projects that demonstrates some of the inner workings of the MCP and architectural patterns when integrating with various Agents as well as Agentforce.
