Skip to content

Quickstart (5 minutes)

What are we going to do?

Create real-time text editor between two peers.

  1. Account setup.
  2. Run a demo locally.

Let’s get started.

1. Your Account

Sign up for a PulseBeam account and get an api_key and api_secret.

  1. Go to cloud.pulsebeam.dev
  2. Login / create and account
  3. Create a project, name your project.
    • Note: Plans are scoped to a project. Your project is Sandbox (free) by default until you change it. Contact us to change it.
  4. Create a keypair on your project, give your keypair a name, e.g. demokey
  5. Store those keys! You will not be able to access the private key again (but if you lose it or want to rotate, feel free to delete and recreate keys)

2. Serve it

Now that you’ve created your account and obtained your keys, let’s set up your local development environment.

You will need npm and node.js installed on your system. If you don’t have them, see their installation instructions

Pull down the project:

Terminal window
git clone git@github.com:PulseBeamDev/pulsebeam-js.git
cd pulsebeam-js/demo-cdn

Open index.html in your editor of choice and replace these lines with your key:

apiKey: "kid_<...>",
apiSecret: "sk_<...>",

Run demo locally with:

Terminal window
npm i
npm run start

You should now have a server running locally on port 3000

3. See it

Here’s what you should see:

Congratulations!

You’ve set up a real-time peer-to-peer connection using PulseBeam.

Next steps:

Other Demos

Google Meet Clone

Check it out live: https://meet.pulsebeam.dev/

Read the source: https://github.com/PulseBeamDev/pulsebeam-js/tree/main/demo-react

Troubleshooting

  • Check browser console, network tab, make sure your application received a valid auth token. Your request/response should look something like:
    {
    "request": {
    "method": "POST",
    "url": "https://cloud.pulsebeam.dev/sandbox/token",
    },
    "response": {
    "status": 200,
    "content": {
    "text": "eyJhbGciOiJFZERTQSIsImtpZCI6ImtpZF8wZGZhNTY5YjEwODUwYTVhIn0.eyJleHAiOjE3Mzg3OTQzMTMsImdpZCI6ImRlZmF1bHQiLCJwaWQiOiJwZWVyLTg2IiwiYXAiOnsiZ3JvdXBfaWQiOiIqIiwicGVlcl9pZCI6IioifX0.MOdiTUebb_n-WiAV8_2UiaA2YO8JvenQ0J9wkU7_wEtVHli_ySTM51u4SHMtpjgkjHuY70OjPrGpM-Daj7UMAg"
    },
    },
    },
  • If your response is something like: Status code 500 Something went wrong: failed to create sandbox token Check your keys in index.html
  • The token is the text in the response (example above). You can decode it to inspect further. When you decode it, you should see something like:
    {
    "header": {
    "alg": "EdDSA",
    "kid": "kid_0dfa569b10850a5a"
    },
    "payload": {
    "exp": 1738794313,
    "gid": "default",
    "pid": "peer-86",
    "ap": {
    "group_id": "*",
    "peer_id": "*"
    }
    }
    }
    Note: Your decoder may throw an “invalid signature” error when it does not support the algorithm of the token. We currently use EdDSA, which is fairly new (and well regarded).
  • Port 3000 is already in use (Error: listen EADDRINUSE: address already in use :::3000) close other process or change port.
  • Something odd? Check you node version with node -v and npm -v. If older than 23.5.0 & 11.0.0 try nvm use node or nvm use 23.5
  • Something else? Checkout logs in browser console or contact us!