How to use the @colyseus/schema.Reflection.encode 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 / src / serializer / SchemaSerializer.ts View on Github external
public handshake() {
    /**
     * Cache handshake to avoid encoding it for each client joining
     */
    if (!this.handshakeCache) {
      this.handshakeCache = (this.state && Reflection.encode(this.state));
    }

    return this.handshakeCache;
  }