Skip to content

Migrating to version 0.10 (from 0.9)

Server-side

EntityMap<T> has been removed. If you're using EntityMap<T> to describe a map of entities, you should use the plain TypeScript alternative now. e.g. Replace "EntityMap<Player>" with "{[id: string]: Player}", or migrate to the new serializer.

New default serializer

Colyseus 0.10 has introduced a new serialization method (SchemaSerializer). Even though it's recommened to use the new serializer, you can continue using the previous one (FossilDeltaSerializer).

I want to continue using the previous serializer

No problem, check below how to continue using the previous serializer using TypeScript or plain JavaScript.

import { Room, FossilDeltaSerializer, serialize } from "colyseus";

@serialize(FossilDeltaSerializer)
class MyRoom extends Room {
    // your room definition
}
const colyseus = require('colyseus');

class MyRoom extends colyseus.Room {
    // your room definition
}
colyseus.serialize(colyseus.FossilDeltaSerializer)(MyRoom);

I want to migrate to the new serializer

Great, hopefully you won't have to make many changes in your project. In the client-side, the way to listen for state patches has changed slightly.

Client-side

colyseus-unity3d

It's highly recommended to migrate to the new schema serializer. See how to generate the schema in the client-side based on the definitions from the server.

  • client.id has been renamed to client.Id
  • room.id has been renamed to room.Id
  • room.name has been renamed to room.Name
  • room.sessionId has been renamed to room.SessionId
  • room.state has been renamed to room.State
  • e.message has been renamed to e.Message (on MessageEventArgs and ErrorEventArgs)
  • Room<T> needs to provide the generic type for state holder
    • when using Fossil Delta, it's Room<IndexedDictionary<string, object>>
    • when using Schema it's Room<YourStateClass>
  • RoomUpdateEventArgs has been renamed to StateChangeEventArgs<T>
    • T is IndexedDictionary<string, object> when using Fossil Delta
    • T is YourStateClass when using Schema.
    • e.state has been renamed to e.State
Back to top