Driver

The driver is responsible for storing and retrieving room data for match-making.

Overview

When a room is created, deleted, or its “metadata” is properties are updated - the driver is responsible for storing and retrieving this information.

Available Drivers

A PostgreSQL driver is planned for Colyseus v1.0.

See Roadmap, and please consider sponsoring to help reach this goal

Local In-Memory

The default driver used by Colyseus is the LocalDriver, which stores all room data in memory. This driver is suitable for development and small-scale single-process applications.

Redis

The RedisDriver stores room data in a Redis database. This driver is suitable for large-scale multi-process applications and is recommended for production environments.

npm install --save @colyseus/redis-driver
app.config.ts
import config from "@colyseus/tools";
import { RedisDriver } from "@colyseus/redis-driver";
 
export default config({
    options: {
        driver: new RedisDriver(/* connection options */),
        // ...
    }
    // ...
});

MongoDB

The MongoDriver stores room data in a MongoDB database. This driver is not actively maintained and is not recommended for production environments.

app.config.ts
import config from "@colyseus/tools";
import { MongooseDriver } from "@colyseus/mongoose-driver";
 
export default config({
    options: {
        driver: new Mongoose(/* connection options */),
        // ...
    }
    // ...
});
Last updated on