TeamPlay provides a server-side API for setting up the backend and handling connections. This API is typically used in your server setup code.
Creates a new TeamPlay backend instance.
Initializes the connection handler for WebSocket connections.
backend: The TeamPlay backend instance created with createBackend().options (optional): An object with the following properties:
fetchOnly (default: true): If true, server-side subscriptions are not reactive.Returns an object with an upgrade function to be used with a Node.js HTTP server.
TeamPlay's server module also re-exports some utilities:
ShareDB: The underlying ShareDB library.mongo, mongoClient, createMongoIndex: MongoDB utilities.redis, redlock: Redis utilities.sqlite: SQLite utility.These can be imported from teamplay/server if needed for advanced configurations.
MONGO_URL environment variable.REDIS_URL environment variable for proper scaling.