@jamsocket/session-backend
v0.0.5
Published
A preview of the upcoming Jamsocket Backend SDK
Downloads
15
Keywords
Readme
Usage
import { JamsocketBackend } from '@jamsocket/session-backend'
const jamsocketBackend = new JamsocketBackend() // auto-configures itself from environment variables
// listenForRequests is assumed to start your application server on the given port. We can either do this
// before or after awaiting the key assignment, but we MUST be ready for requests on jamsocketBackend.port before
// we call assignment.ready().
listenForRequests(jamsocketBackend.port)
const assignment = await jamsocketBackend.assignment()
console.log('key', assignment.key)
console.log('backendId', assignment.backendId)
// Optionally, do some initialization work here based on the key or other fields of assignment.
assignment.ready()