Quickstart Review
What happened in our Quickstart?
1. You setup your local environment
- Pulled down code
- Built project
- Set your key
2. Started a Server
npm startspun up the HTTP server (localhost:3000)
HTTP Server (localhost:3000) └── / -> index.html - frontend code3. Experienced a Token Request Workflow
- You opened your browser, provided URL
localhost:3000, which loadedindex.html. index.htmlinstructs browser to make a request tohttps://cloud.pulsebeam.dev/sandbox/token(lets refer to this as/tokenfor short) for a token using the key you provided
Browser → GET / -> index.html → Request Token from /token4. Created tokens
/tokenuses@pulsebeam/serverSDK with your key to generate tokens.
/token → @pulsebeam/server SDK → Token → Browser5. Started peers
index.htmluses@pulsebeam/peerSDK with the token to create a peer and communicate with PulseBeam signaling servers.
Token → @pulsebeam/peer SDK peer.start() → PulseBeam Signaling Servers6. Established a Peer-to-Peer Connection
- Second tab enters
peer-29in the textbox and clicksConnect. - The second browser initiates a connection to the first browser.
- PulseBeam established a connection.
- Note:
index.htmldefines application logic: create data channel and sync text in real time
peer → peer.connect('peer-29') → PulseBeam Signaling Servers → connectedSummary
Tips
Logs can be viewed from your console browser inspector.
PulseBeam will work globally within the scope of your project.
- Peers are not limited to two tabs within the same browser.
- You can establish a connection between peers on different networks or machines.
We can’t wait to see what you build on PulseBeam! Connect on Discord!
Next Steps
- 🛑 The way we received tokens in the demo (by embedding our private key in our client) was insecure and NOT production ready! See our guide on serving tokens in production
- To get some bonus points, see below
- Dive into our Concepts
- Use PulseBeam in your applications 😊
Bonus points
Experiment with the demo!
Update frontend to work with PulseBeam CLI instead of /auth for token generation.
Hint:
One way is to create another input fortoken, and add a peer.start() button.