TeamPlay can be used in two modes: client-only mode and with server synchronization. Choose the appropriate installation method based on your needs.
If you just want a client-only mode without any data being synced to the server, you don't need to set up anything extra. You can jump directly to the Usage section after installing the package.
To enable synchronization with the server, follow these steps:
Enable the connection on the client somewhere early in your client app:
On the server, you need to create the TeamPlay backend and then create a connection handler for WebSockets:
By default no extra database setup is needed and the data is gonna be saved into an SQLite file local.db
in the root of your project.
You can still use the MongoDB query syntax with aggregations which is emulated using mingo
.
MONGO_URL
.REDIS_URL
(Redis).TeamPlay's createBackend()
is a wrapper around creating a ShareDB's backend. You can instead manually create a ShareDB backend yourself and pass it to initConnection()
. ShareDB
is re-exported from teamplay/server
, you can get it as import { ShareDB } from 'teamplay/server'
.
Now that you have TeamPlay installed and configured, you're ready to start using it in your application!