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()
@jamsocket/session-backend
0.0.5 • Public • PublishedReadme
Keywords
nonePackage Sidebar
Install
npm i @jamsocket/session-backend
Weekly Downloads
7
Version
0.0.5
License
MIT
Unpacked Size
27.3 kB
Total Files
9