Aller au contenu

Migrating to version 0.14.18 (from 0.14.x)

Version 0.14.18 introduces some soft-deprecations, and a breaking change regarding MongooseDriver.

MongooseDriver should now be imported from @colyseus/mongoose-driver

// Replace this
import { MongooseDriver } from "colyseus/lib/matchmaker/drivers/MongooseDriver"

// With this
import { MongooseDriver } from "@colyseus/mongoose-driver";
// Replace this
const MongooseDriver = require("colyseus/lib/matchmaker/drivers/MongooseDriver").MongooseDriver;

// With this
const MongooseDriver = require("@colyseus/mongoose-driver").MongooseDriver;

Preparing for v0.15 Transport abstractions

The server, pingInterval, pingMaxRetries and verifyClient options are being soft-deprecated. These options are now part of the default WebSocketTransport implementation.

DEPRECATION WARNING: 'pingInterval', 'pingMaxRetries', 'server', and 'verifyClient' Server options will be permanently moved to WebSocketTransport on v0.15

No immediate action required here!

This is a soft deprecation. Read more about custom Transport options here.

// Replace this
import { Server } from "colyseus";
const gameServer = new Server({
    server: http.createServer(app),
    pingInterval: 5000,
    pingMaxRetries: 3,
})

// With this
import { Server } from "colyseus";
import { WebSocketTransport } from "@colyseus/ws-transport";
const gameServer = new Server({
    transport: new WebSocketTransport({
        server: http.createServer(app),
        pingInterval: 5000,
        pingMaxRetries: 3,
    })
});

Retour en haut de la page