Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Server does not sync state with clients on the latest version

See original GitHub issue

Steps to Reproduce

Example CodesSandbox:

  1. Open CodeSandbox
  2. Preview of HTML shows client’s state (check console for more details).
  3. Client sends ping message to server.
  4. Server every 1s modifies the state.


Server receives ping messages, but client is not updated with the latest state. Checked with DevTools, server is not sending any message (sends only two at the beginning, I think they are schema types related).

Adding @colyseus/monitor, and inspecting room’s state also shows empty state.

Your Environment

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

jog1tcommented, Mar 13, 2022

It’s looks like TypeScript’s type decorator also does not work 😢. I’ve tried also using different versions, but without any luck. Here’s the same example from CodeSandbox, but uses ts-node or vite-node to run the server -

🎉 What has worked for me is to define a schema class similar to this (see working-solution branch):

class State extends Schema {
  constructor() {
    super(); = "";
    this.number = 0;

defineTypes(State, {
  property: "string",
  number: "number",

interface State extends Schema {
  property: string;
  number: number;
WesleyClementscommented, Apr 8, 2022

This seems to only be a problem for TypeScript if you are compiling to ES2022/ESNext. Public instance fields are added to subclass instances using Object.defineProperty immediately after the super() call returns so the property defined in the Schema constructor is being overwritten. I don’t think there is an elegant solution to fix this currently. Could move the getters and setters definition to outside the constructor but that’s kind of wonky.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot issues with WSUS client agents - Microsoft Learn
This article helps you diagnose and resolve issues with the Windows Server Update Services (WSUS) client agents. Original product version: ...
Read more >
Client/Server state synchronization for desktop application
Client /Server state synchronization for desktop application · Each client then only applies the new update to their state locally to sync back ......
Read more >
NTP client not able to auto sync with server
The problem is client is not able to sync the time with server. NTP version: 4.2.8p13 (on client). NTP conf file (UPDATED): driftfile...
Read more >
Troubleshooting NTP Sync to Windows Time Servers
When a cluster has been configured to use a stand-alone Windows server or Domain controller as an NTP time source, the CVMs (Controller...
Read more >
Synchronize resources efficiently | Google Calendar
Initial full sync is performed once at the very beginning in order to fully synchronize the client's state with the server's state. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found