An Intro to Jamsocket
Jamsocket is a hosted platform for session-lived backends, servers that are created by an application on demand, typically run for the duration of a user's session, and are spun down when no longer in use.
There are three main concepts to understand Jamsocket:
- Containers are the packaged form of your runtime code that Jamsocket will run. These are the same as Docker or OCI containers.
- Services are a logical grouping of containers that Jamsocket uses. When you spawn a backend, you refer to it by its service name. Jamsocket uses the service name (and optionally, a provided tag, which works like in Docker) to find the appropriate container to run.
- Backends are the actual running instances of containers created through Jamsocket. Every backend has a unique name, and
{name}.jamsocket.run
acts as a hostname for that container when used with HTTPS.
The life of a spawner backend is:
- You create a service with the Jamsocket CLI (or with the Jamsocket API).
- You build a container using a standard container builder workflow (e.g.
docker build
) - You push the container you built to that service using the Jamsocket CLI.
- You spawn that service, to create a backend.
In a production application, step 1 happens once, steps 2 and 3 happen every time you deploy, and step 4 happens (through an API) whenever your application requires a new backend (e.g. a user opens a document).