SlideShare a Scribd company logo
1 of 20
Create Lively Lightning
Components with
Streaming API
Anshul Verma
Cynoteck Technology Solutions LLC
Email: anshul.verma@Cynoteck.com
Twitter: @toanshulverma
Agenda
• Need
• Traditional Model (Pull)
• Push notifications (browser)
• Example Use cases
• Live Demo
• Salesforce Streaming API
• What’s under the hood
• Code Walkthrough
• Q&A
Need
• Stale/ Old information
• True Collaboration with real time updates
• Decisions with most up to date information
• Faster response
• Adherence to Governor limits
Traditional Model (Pull)
Server
(Salesforce)
Client
(Browser)
2 3
Opens
connection
Connection
established
4 5
2
3
Client sends
request
4
Server sends
response
5
Connection
closed
6
Execution block -
every time
update is
required
1 6
User wants to view
updated
information
1
Push Notifications (browser)
Server
(Salesforce)
Client
(Browser)
1 2
Subscribe to a
Topic
Subscription
Confirmation
5
6
3
4
New information
arrives on server
Message pushed to
client
6
5
Execution block -
every time
update is
required
3 4
Initiate Handshake
Handshake
successful
1
2
Publisher/ Subsriber Model (Pub-Sub)
Publisher
(Salesforce)
Account updates New Payments New Credits
Subscriber 1 Subscriber 2 Subscriber 3 Subscriber N
……
Example Use Cases
Real time dashboards Real time notifications
Live Demo
Streaming API Basics
Push Topic
- Query - SOQL query qualifying a message
- NotifyForFields - Specify Fields which qualify to generate a push message
- Valid Values: All, Referenced (default), Select, Where
- NotifyForOperations – specify which operations qualify to generate a push message
- Valid Values: All (default), Create, Extended, Update
What is a Push Topic
Salesforce Streaming API Library – under the hood
- Javascript based API to internally handle complexity of connecting to Salesforce’s streaming API
and provides a developer friendly way
- Protocol – Bayeux
- Defines how asynchronous messages should be transported
- Messaging API - CometD
- Implements Bayeux protocol to create subscription endpoints and handle message distribution
- Streaming technique - Long Polling
- Client sends a request to server
- Server holds back response, untill a new message arrives
Long Polling (under the hood)
Server
(Salesforce)
Client
(Browser)
Salesforce Streaming API Library
Long polling mechanism to open connection to
server and allow server to wait and respond
Handshake Subscribe
New Message
Push
Notification
Code Walkthrough
Sample Notifications App
Step 1 : Create Push Topic
Push Topic
- Query - SOQL query qualifying a message
- NotifyForFields - Select
- NotifyForOperations – All
Step 2 : Initialize (handshake)
Server
(Salesforce)
Client
(Browser)
1 2
Step 3 : Subscribe
Server
(Salesforce)
Client
(Browser)
3 4
Step 4 : Handle Incoming Message
Server
(Salesforce)
Client
(Browser)
6
• Trailhead - https://trailhead.salesforce.com/en/modules/api_basics/units/api_basics_streaming
• Github (Demo source) –
• DeveloperForce - https://developer.salesforce.com/page/Streaming_API
• Streaming API Developer guide - https://developer.salesforce.com/docs/atlas.en-
us.api_streaming.meta/api_streaming/intro_stream.htm
Demo Source code
https://github.com/toanshulverma/Demo-RealTimeAlerts
Resources
Thank you

More Related Content

What's hot

Connecting to salesforce and using database in mule
Connecting to salesforce and using database in muleConnecting to salesforce and using database in mule
Connecting to salesforce and using database in mule
RaviShankar Mishra
 

What's hot (20)

Mule Anypoint API Gateway
Mule Anypoint API GatewayMule Anypoint API Gateway
Mule Anypoint API Gateway
 
Apply Rate Limiting Policy
Apply Rate Limiting Policy Apply Rate Limiting Policy
Apply Rate Limiting Policy
 
Kentico 8 EMS API Deep Dive
Kentico 8 EMS API Deep DiveKentico 8 EMS API Deep Dive
Kentico 8 EMS API Deep Dive
 
MuleSoft certified platform architect-level 1 Real Exam Questions
MuleSoft certified platform architect-level 1 Real Exam QuestionsMuleSoft certified platform architect-level 1 Real Exam Questions
MuleSoft certified platform architect-level 1 Real Exam Questions
 
ESB Online Training Part 2
ESB Online Training Part 2ESB Online Training Part 2
ESB Online Training Part 2
 
Mule soa
Mule soaMule soa
Mule soa
 
Dog Food Con 2015 Integrate & Automate CMS Deployments
Dog Food Con 2015 Integrate & Automate CMS DeploymentsDog Food Con 2015 Integrate & Automate CMS Deployments
Dog Food Con 2015 Integrate & Automate CMS Deployments
 
Anypoint platform for api
Anypoint platform for apiAnypoint platform for api
Anypoint platform for api
 
SOAP To REST API Proxy
SOAP To REST API ProxySOAP To REST API Proxy
SOAP To REST API Proxy
 
Rate Limiting - SLA Based Policy
Rate Limiting - SLA Based PolicyRate Limiting - SLA Based Policy
Rate Limiting - SLA Based Policy
 
Best practices for multi saa s integrations
Best practices for multi saa s integrationsBest practices for multi saa s integrations
Best practices for multi saa s integrations
 
Mule api
Mule  apiMule  api
Mule api
 
Mule esb stripe
Mule esb stripeMule esb stripe
Mule esb stripe
 
Raml api designer
Raml   api designerRaml   api designer
Raml api designer
 
Magento Developer Talk. Microservice Architecture and Actor Model
Magento Developer Talk. Microservice Architecture and Actor ModelMagento Developer Talk. Microservice Architecture and Actor Model
Magento Developer Talk. Microservice Architecture and Actor Model
 
Dyna trace
Dyna traceDyna trace
Dyna trace
 
Custom connector development using mule DevKit
Custom connector development using mule DevKitCustom connector development using mule DevKit
Custom connector development using mule DevKit
 
Mule real-world-old
Mule real-world-oldMule real-world-old
Mule real-world-old
 
Real Time Web with SignalR
Real Time Web with SignalRReal Time Web with SignalR
Real Time Web with SignalR
 
Connecting to salesforce and using database in mule
Connecting to salesforce and using database in muleConnecting to salesforce and using database in mule
Connecting to salesforce and using database in mule
 

Similar to Forcelandia 2018 - Create lively lightning components with streaming api

Using WebSockets with ColdFusion
Using WebSockets with ColdFusionUsing WebSockets with ColdFusion
Using WebSockets with ColdFusion
cfjedimaster
 
Building Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalRBuilding Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalR
Shravan Kumar Kasagoni
 

Similar to Forcelandia 2018 - Create lively lightning components with streaming api (20)

Publisher / subscriber integrations using Episerver
Publisher / subscriber integrations using EpiserverPublisher / subscriber integrations using Episerver
Publisher / subscriber integrations using Episerver
 
Salesforce Streaming event - PushTopic and Generic Events
Salesforce Streaming event - PushTopic and Generic EventsSalesforce Streaming event - PushTopic and Generic Events
Salesforce Streaming event - PushTopic and Generic Events
 
Salesforce Integration Pattern Overview
Salesforce Integration Pattern OverviewSalesforce Integration Pattern Overview
Salesforce Integration Pattern Overview
 
HTTP Server Push Techniques
HTTP Server Push TechniquesHTTP Server Push Techniques
HTTP Server Push Techniques
 
Adding Real-time Features to PHP Applications
Adding Real-time Features to PHP ApplicationsAdding Real-time Features to PHP Applications
Adding Real-time Features to PHP Applications
 
Using WebSockets with ColdFusion
Using WebSockets with ColdFusionUsing WebSockets with ColdFusion
Using WebSockets with ColdFusion
 
Learn Advanced JAVA at ASIT
Learn Advanced JAVA at ASITLearn Advanced JAVA at ASIT
Learn Advanced JAVA at ASIT
 
Difference between Client Polling vs Server Push vs Websocket vs Long Polling
Difference between Client Polling vs Server Push vs Websocket vs Long PollingDifference between Client Polling vs Server Push vs Websocket vs Long Polling
Difference between Client Polling vs Server Push vs Websocket vs Long Polling
 
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...
 
Introduction to SignalR
Introduction to SignalRIntroduction to SignalR
Introduction to SignalR
 
EAI design patterns/best practices
EAI design patterns/best practicesEAI design patterns/best practices
EAI design patterns/best practices
 
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsys
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsysUsing communication and messaging API in the HTML5 world - GIl Fink, sparXsys
Using communication and messaging API in the HTML5 world - GIl Fink, sparXsys
 
WSO2 MASTER CLASS ITALIA #11 - APIM 4.0 & approccio event based
WSO2 MASTER CLASS ITALIA #11 - APIM 4.0 & approccio event basedWSO2 MASTER CLASS ITALIA #11 - APIM 4.0 & approccio event based
WSO2 MASTER CLASS ITALIA #11 - APIM 4.0 & approccio event based
 
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...
Building a company-wide data pipeline on Apache Kafka - engineering for 150 b...
 
Building Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalRBuilding Realtime Web Applications With ASP.NET SignalR
Building Realtime Web Applications With ASP.NET SignalR
 
Best practices of building data streaming API
Best practices of building data streaming APIBest practices of building data streaming API
Best practices of building data streaming API
 
IoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@WorkIoT with SignalR & .NET Gadgeteer - NetMF@Work
IoT with SignalR & .NET Gadgeteer - NetMF@Work
 
Event-Based API Patterns and Practices
Event-Based API Patterns and PracticesEvent-Based API Patterns and Practices
Event-Based API Patterns and Practices
 
Build and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API GatewayBuild and Manage Your APIs with Amazon API Gateway
Build and Manage Your APIs with Amazon API Gateway
 
Integration study group 2: Patterns
Integration study group 2: PatternsIntegration study group 2: Patterns
Integration study group 2: Patterns
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Forcelandia 2018 - Create lively lightning components with streaming api

  • 1. Create Lively Lightning Components with Streaming API Anshul Verma Cynoteck Technology Solutions LLC Email: anshul.verma@Cynoteck.com Twitter: @toanshulverma
  • 2.
  • 3. Agenda • Need • Traditional Model (Pull) • Push notifications (browser) • Example Use cases • Live Demo • Salesforce Streaming API • What’s under the hood • Code Walkthrough • Q&A
  • 4. Need • Stale/ Old information • True Collaboration with real time updates • Decisions with most up to date information • Faster response • Adherence to Governor limits
  • 5. Traditional Model (Pull) Server (Salesforce) Client (Browser) 2 3 Opens connection Connection established 4 5 2 3 Client sends request 4 Server sends response 5 Connection closed 6 Execution block - every time update is required 1 6 User wants to view updated information 1
  • 6. Push Notifications (browser) Server (Salesforce) Client (Browser) 1 2 Subscribe to a Topic Subscription Confirmation 5 6 3 4 New information arrives on server Message pushed to client 6 5 Execution block - every time update is required 3 4 Initiate Handshake Handshake successful 1 2
  • 7. Publisher/ Subsriber Model (Pub-Sub) Publisher (Salesforce) Account updates New Payments New Credits Subscriber 1 Subscriber 2 Subscriber 3 Subscriber N ……
  • 8. Example Use Cases Real time dashboards Real time notifications
  • 11. Push Topic - Query - SOQL query qualifying a message - NotifyForFields - Specify Fields which qualify to generate a push message - Valid Values: All, Referenced (default), Select, Where - NotifyForOperations – specify which operations qualify to generate a push message - Valid Values: All (default), Create, Extended, Update What is a Push Topic
  • 12. Salesforce Streaming API Library – under the hood - Javascript based API to internally handle complexity of connecting to Salesforce’s streaming API and provides a developer friendly way - Protocol – Bayeux - Defines how asynchronous messages should be transported - Messaging API - CometD - Implements Bayeux protocol to create subscription endpoints and handle message distribution - Streaming technique - Long Polling - Client sends a request to server - Server holds back response, untill a new message arrives
  • 13. Long Polling (under the hood) Server (Salesforce) Client (Browser) Salesforce Streaming API Library Long polling mechanism to open connection to server and allow server to wait and respond Handshake Subscribe New Message Push Notification
  • 15. Step 1 : Create Push Topic Push Topic - Query - SOQL query qualifying a message - NotifyForFields - Select - NotifyForOperations – All
  • 16. Step 2 : Initialize (handshake) Server (Salesforce) Client (Browser) 1 2
  • 17. Step 3 : Subscribe Server (Salesforce) Client (Browser) 3 4
  • 18. Step 4 : Handle Incoming Message Server (Salesforce) Client (Browser) 6
  • 19. • Trailhead - https://trailhead.salesforce.com/en/modules/api_basics/units/api_basics_streaming • Github (Demo source) – • DeveloperForce - https://developer.salesforce.com/page/Streaming_API • Streaming API Developer guide - https://developer.salesforce.com/docs/atlas.en- us.api_streaming.meta/api_streaming/intro_stream.htm Demo Source code https://github.com/toanshulverma/Demo-RealTimeAlerts Resources

Editor's Notes

  1. Two speaker title slide