From 14cd96055245b3fe2f747e911b503bcf97e7f1cd Mon Sep 17 00:00:00 2001 From: Adrian Czerwiec Date: Fri, 22 May 2026 15:58:16 +0200 Subject: [PATCH] adjust the docs --- docs/how-to/backend/server-setup.mdx | 55 ++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/docs/how-to/backend/server-setup.mdx b/docs/how-to/backend/server-setup.mdx index 8d303cba..e98106d0 100644 --- a/docs/how-to/backend/server-setup.mdx +++ b/docs/how-to/backend/server-setup.mdx @@ -61,9 +61,46 @@ Let's setup everything you need to start communicating with a Fishjam instance. First of all, view your app in the [**Fishjam developer panel**](https://fishjam.io/app) and copy your **Fishjam ID** and the **Management Token**. They are required to proceed. Now, we are ready to dive into the code. +The verifying factory constructs the client and pings the Fishjam backend with the supplied credentials, so a bad `fishjamId` or `managementToken` fails at startup instead of on the first room operation. + - + + ```ts + process.env.FISHJAM_ID = "aaa"; + process.env.FISHJAM_MANAGEMENT_TOKEN = "bbb"; + + // ---cut--- + import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; + + const fishjamClient = await FishjamClient.create({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!, + }); + ``` + + + + + + ```python + import os + from fishjam import FishjamClient + + fishjam_client = FishjamClient.create_and_verify( + fishjam_id=os.environ["FISHJAM_ID"], + management_token=os.environ["FISHJAM_MANAGEMENT_TOKEN"], + ) + ``` + + + + +If you need synchronous construction (for example inside a framework plugin that is not async), use the plain constructor and verify separately. The constructor only checks that the fields are non-empty; it does not contact the backend. + + + + ```ts process.env.FISHJAM_ID = "aaa"; process.env.FISHJAM_MANAGEMENT_TOKEN = "bbb"; @@ -71,10 +108,12 @@ They are required to proceed. Now, we are ready to dive into the code. // ---cut--- import { FishjamClient } from '@fishjam-cloud/js-server-sdk'; - const fishjamId = process.env.FISHJAM_ID; - const managementToken = process.env.FISHJAM_MANAGEMENT_TOKEN; + const fishjamClient = new FishjamClient({ + fishjamId: process.env.FISHJAM_ID!, + managementToken: process.env.FISHJAM_MANAGEMENT_TOKEN!, + }); - const fishjamClient = new FishjamClient({ fishjamId, managementToken }); + await fishjamClient.checkCredentials(); ``` @@ -85,10 +124,12 @@ They are required to proceed. Now, we are ready to dive into the code. import os from fishjam import FishjamClient - fishjam_id = os.environ["FISHJAM_ID"] - management_token = os.environ["FISHJAM_MANAGEMENT_TOKEN"] + fishjam_client = FishjamClient( + fishjam_id=os.environ["FISHJAM_ID"], + management_token=os.environ["FISHJAM_MANAGEMENT_TOKEN"], + ) - fishjam_client = FishjamClient(fishjam_id, management_token) + fishjam_client.check_credentials() ```