ConceptsSpawn and connect

Connecting to a Session Backend

When making a spawn request via the HTTP API or client library, Jamsocket returns a connect response that contains a Connection URL. This Connection URL allows you to connect to the server running in your session backend and access endpoints on that server. See the Quickstart for a walkthrough.

A connection URL looks like this:

https://8nyg2.p.jamsocket.net/eqYLfYmVbdIwSukbIxiFJNAjKz8KJLECmfYMQfqSgKs/"
        \___/                 \_________________________________________/
      backend ID                         connection token

This Connection URL comes with a secret token. Treat the connection token like a bearer token, because any client that knows it can access the backend.

⚠️

If the connection token is not included in a request, the connection will be rejected. See the Troubleshooting page for an example error that occurs when the connection token is stripped from the URL.

Identifying the Connection URL

In Production

In production, a Jamsocket connect response will include a URL parameter. That URL parameter is the Connection URL.

connect-response-example
{
  "backend_id": "knrv5",
  "spawned": true,
  "status": "scheduled",
  "token": "4ahosrz8D53AmXj-Pzs0XlGANt3yG56asVqvNVzma9s",
  "url": "https://knrv5.p.jamsocket.net/4ahosrz8D53AmXj-Pzs0XlGANt3yG56asVqvNVzma9s/",
  "secret_token": "qB9Tky7m10ym-x0w5I6eTn41odJawYwVW4EgabC4r12",
  "status_url": "https://api.jamsocket.com/v2/backend/knrv5/status",
  "ready_url": "https://ready.jamsocket.com/knrv5/4ahosrz8D53AmXj-Pzs0XlGANt3yG56asVqvNVzma9s/"
}

The basic structure of a Connection URL looks like this:

https://BACKEND_ID.p.jamsocket.net/AUTH_TOKEN/

In Development with the Dev CLI

When running the Dev CLI, the connect response values, including the Connection URL, may look a little different because it is running a local version of Jamsocket.

connect-response-example
{
  "backend_id": "ebb8ljmndix2ge",
  "spawned": true,
  "status": "scheduled"
  "token": "ClpYXET8OA-ie7ufWFHE5y0Q-NbghE04niQ2fwBZe40",
  "url": "http://localhost:9090/ClpYXET8OA-ie7ufWFHE5y0Q-NbghE04niQ2fwBZe40/",
  "secret_token": "129aky7mT0ym-x0w5I88eTn41FFJawYwV4EgabC4r12",
  "status_url": "http://localhost:8080/v2/backend/ebb8ljmndix2ge/status",
  "ready_url": ""
}
Built by Jamsocket.