How to use the @colyseus/schema.Reflection.decode function in @colyseus/schema

To help you get started, we’ve selected a few @colyseus/schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github colyseus / colyseus.js / src / serializer / SchemaSerializer.ts View on Github external
handshake(bytes: number[]) {
        if (this.state) {
            // validate client/server definitinos
            const reflection = new Reflection();
            reflection.decode(bytes);

        } else {
            // initialize reflected state from server
            this.state = Reflection.decode(bytes) as any;
        }
    }
}