Skip to main content
Markdown

HTTP API and protocol

Everything the realtime SDK does on your server is open to any language. The packages for Node, PHP and Python are one way to do it. A server in Go, Ruby, Java, .NET, Rust or anything else does the same with the HTTP API and the protocol on these pages.

Your server has three jobs, and these pages give each in full, with code:

JobWhat your server doesPage
Call WordPlus Cloudsends events to rooms and users and asks the pages of a user, reads the rooms in use, who is in a room and who is online, the group calls, the live streams and their chat, what your app uses and the deliveries of its webhook, takes a user out of everything or out of a room, call or stream, mutes and ends calls, and keeps the chat of a streamsigning requests, then the API reference
Hear WordPlus Cloudtakes the webhook: page events to keep, rooms filling and emptying, people coming online, streams going livewebhooks
Answer the browserthe routes the browser SDK asks: who may join which room, call whom, host or watch a stream, and the keys to open what arrivesyour server routes

What travels is sealed with keys your server makes from a local key WordPlus Cloud never sees: sealing. Every value your code computes can be checked against the test values before it talks to WordPlus Cloud at all.

Your credentials​

Your app page in your WordPlus Cloud account gives two, and you make the third:

WORDPLUS_SITEyour app key, sent with every request. Not secret
WORDPLUS_SECRETyour app secret. Keep it on your server: it signs your requests and your tokens, and checks the webhooks
WORDPLUS_LOCAL_KEY64 hex characters you make (openssl rand -hex 32). Keep it on your server, the same on every one of them and for the life of your app: every key that seals what travels is made from it

A first request​

The API is at https://rest.wordplus.cloud. A request is JSON, signed with three headers. With the wordplus shell function from signing requests:

export WORDPLUS_SITE=s1500000123 WORDPLUS_SECRET=…
source wordplus.sh

wordplus POST /wordplus/realtime/emit '{"rooms":["order:42"],"event":"updated","data":{"status":"shipped"}}'
# {"ok":true,"ids":{}}

Every page in the room order:42 gets updated with { status: 'shipped' } at once.

Answers and refusals​

Every answer is JSON with ok. A refusal is { "ok": false, "error": code } with its HTTP status:

StatusCodes
400bad_request, bad_room, reservedthe request is not one the API takes, or an event named as one kept for the room itself
401missing_signature, stale_signature, unknown_site, bad_signaturethe signature was not taken. stale_signature is a clock off by more than 5 minutes
403not_included, hostyour plan does not include it. A host is never taken out of their own stream
413too_large, too_manydata over 1 MB, over 1,000 rooms or users in an event, or 100 events in a batch
500servertry again

A whole server in Go​

The Go example is an app server written from these pages alone, with no package of ours: its own rules, the routes the browser SDK asks, sending sealed events, the webhook, calls, group calls and live streams. Its code is yours to download, and the checks of the SDK run the browser SDK against it.

For AI coding agents​

These pages are written for agents as much as for people. Point yours at:

  • https://docs.wordplus.cloud/api/openapi.yaml: the API as OpenAPI 3.1, every request, answer and refusal, with examples in five languages.
  • https://docs.wordplus.cloud/llms-full.txt: all of the docs as one text file, these pages included.
  • https://docs.wordplus.cloud/api/vectors.json: the test values, to check what it writes.