- https://lwc.dev - Lightning Web Components
- Official gRPC Node JS Guide
- This project include Subscription to the Streaming API in Salesforce in the form of a messanger chat.
- Connection to Salesforce Api via - JSForce
- It's quick demo for building apps in and out of Salesforce using Lightning Web Components (LWC) and gRPC Server to allow Streaming and Real-time server push updates.
- Clone this repository
git clone https://github.com/vyuvalv/lwc-grpc-pubsub.git
- Go into the
salesforce_appfolder - Salesforce App Instructions - Deploy the code into your new scratch org from this folder.
- You will have a Lightning App Page called
PubSub_Demoor you can simply drag and drop the componentPubSub Chat Messengeron any page layout. - A Platform Event Object named
PubSubMessage__ewill need to be deployed. - Issue a Personal Security Token or setup a Connected App on your org to allow login.
- Once you got it working on Salesforce - Copy the Credentials to the OSS app setup.
-
Go into the
oss_appfolder - LWC OSS App Instructions -
Start with
npm install- from the mainoss_appdirectory.- Breakdown of the dependencies installed below :
- run
npm i-npm installgrpc- main library for grpc@grpc/proto-loader- handle protobuffersexpress-sse- for server sent events push to client appjsforce- Connection to Salesforcedotenv- Storing parameters used for the connection to Salesforce Connected App option
-
Setup your Org Credentials inside a new
.envfile onoss_appdirectory as mentioned inside the README file. -
Use the node scripts
npm run buildORnpm run build:developmentto build thedistfolder for this app and to include SLDS inside your project. -
Run
npm run watchoryarn watch- to view the app. -
View on your port - by default
http://localhost:3001for DEV andhttp://localhost:5000for production.
Follow here : https://vyuvalv.medium.com/streaming-salesforce-platform-events-using-grpc-and-nodejs-6fa0206dca0
