Jamsocket Session Backends
Session backends are server processes that you can start instantly with an API call. Your application connects to them from client-side code. When the last client disconnects, the session backend is shut down.
This architecture is commonly used for multiplayer collaboration, sandboxed user code execution, and more.
Session backend basics
There are four main steps to getting a running session backend on Jamsocket.
- Create a service with the Jamsocket CLI, HTTP API, or the Jamsocket dashboard (opens in a new tab).
- Build your session backend code using a standard Docker builder workflow
- Push your containerized session backend to your Jamsocket service.
- Spawn a service to create a running session backend.
Learn how to create, build, push, and spawn session backends using our Quickstart, which covers the basic steps for integrating Jamsocket into a full-stack application.
Session backends for your use case
It can be helpful to think about session backends as a part of a larger application architecture. The most common use cases for Jamsocket include realtime multiplayer applications, data intensive applications, and AI/LLM powered applications.
Realtime Multiplayer
Think of the session backend as a room or document that users can collaborate on.
- Session backends can be shared between multiple clients that connect to it via WebSocket connections.
- Session backends are stateful. They can load the document into memory when they start up, and then act as the authority for that document during that user session.
- Session backends are ephemeral. The backend will gracefully shut down once all clients are disconnected.
To see multiplayer collaboration in action, follow this NextJS SocketIO tutorial for building a shared canvas.
Data Intensive Applications
The session backend gives clients the extra computational power needed for data intensive applications.
- Session backends offer dedicated compute and memory for compute intensive applications. Using BYOC or fully managed, you can designate the amount of compute and memory needed for your application.
- Use the session backend as a coordination layer between data intensive workers and connected clients.
AI/LLM Powered Applications
The session backend provides a stateful environment for AI agents to operate on documents with your users.
- Manage multi-step workflows use a session backend to manage multi-step generative AI flows.
- Use the session backend as a source of truth between clients and AI agents.