- 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_app
folder - Salesforce App Instructions - Deploy the code into your new scratch org from this folder.
- You will have a Lightning App Page called
PubSub_Demo
or you can simply drag and drop the componentPubSub Chat Messenger
on any page layout. - A Platform Event Object named
PubSubMessage__e
will 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_app
folder - LWC OSS App Instructions -
Start with
npm install
- from the mainoss_app
directory.- Breakdown of the dependencies installed below :
- run
npm i
-npm install
grpc
- 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
.env
file onoss_app
directory as mentioned inside the README file. -
Use the node scripts
npm run build
ORnpm run build:development
to build thedist
folder for this app and to include SLDS inside your project. -
Run
npm run watch
oryarn watch
- to view the app. -
View on your port - by default
http://localhost:3001
for DEV andhttp://localhost:5000
for production.
Follow here : https://vyuvalv.medium.com/streaming-salesforce-platform-events-using-grpc-and-nodejs-6fa0206dca0