Y-SweetAdvancedConnection String

Connection string

The connection string is used by your server to authenticate with a Y-Sweet server. You can think of it as an API key and URL combined. It typically looks something like this: yss://TOKEN@api.jamsocket.com/....

This is a secret key that your app will use to create docs and generate client tokens which give clients the ability to read and write y-sweet documents.

If you are using Y-Sweet on Jamsocket, getting a connection string is easy:

Create a Y-Sweet service in the Jamsocket dashboard, go to its page, and click “New connection string”. Give it a description and click “Create”, and copy the connection string.

The connection string can then be used to generate a client token with the @y-sweet/sdk library like so:

import { DocumentManager } from '@y-sweet/sdk'
 
const docManager = new DocumentManager(process.env.CONNECTION_STRING)
const clientToken = await docManager.getOrCreateDocAndToken(docId)
💡

Note: a connection string is different than a client token. A client token is used by a client to read and write a Y-Sweet document. The connection string, on the other hand, is used by your application’s backend to generate client tokens for clients it has authenticated.

Built by Jamsocket.