MapSchema items don't get to the client

Hello, It’s the first time I’m using Colyseus and I ran into problem.

The code for both client and server is written with Haxe. Also I had to switch to alpha 0.14 because Haxe client didn't tolerate “none” states on 0.13.

I have a MapSchema in state. Whenever I update the map, it gets updated properly on the server and onStateChanged event is raised on the client, but the map on the client itself remains empty and consequently on{Add,Remove} events don’t appear.

I have the following code:

Room handler

import kakto.common.schema.WalkableState;

class Walkable extends Room {
  override function onCreate(o:Map<String, Dynamic>) {
    setState(new WalkableState());

  override function onJoin(client:Client, ?o:Map<String, Dynamic>, ?auth:Dynamic) {
    (state:WalkableState).players.set(client.sessionId, new Player());
    return null;


Schema file is common for both client and server with packages changed using conditional compilation. Maybe this is the root of the problem?

#if hxnodejs
import colyseus.server.schema.Schema;
import io.colyseus.serializer.schema.Schema;
import io.colyseus.serializer.schema.MapSchema;

class Player extends Schema {}

class WalkableState extends Schema {
  // There may be anything instead of `Player` type
  #if hxnodejs
  @:type({ map: Player })
  @:type('map', Player)
  public var players = new MapSchema<Player>();

  #if hxnodejs
  public function new() {}


room.onStateChange += (state:WalkableState) -> {
  trace(state.players); // always empty Map

// these two don't get called at all
room.state.players.onAdd = (player, id) -> {
  trace('$id joined');

room.state.players.onRemove = (player, id) -> {
  trace('$id quit');


Hi @kotwys, welcome 👋

The version 0.14 is not yet implemented in Haxe, if you're interested in migrating to 0.14 because of the "none" serializer, I'd suggest using the workaround instead - which is to use a dummy schema as your room state:

class State extends Schema {
  @type("string") dummy: string;

// ...
onCreate() {
  this.setState(new State())

I'll let you know here once the new schema decoder is available in Haxe, it's probably going to happen next month!


Okay, then I’ll wait. I ran ahead a little :)

Thank you @endel for you work!