Server does not sync state with clients on the latest version
See original GitHub issueIssue Description
Steps to Reproduce
Example CodesSandbox: https://codesandbox.io/s/dazzling-mountain-hwzfxh
- Open CodeSandbox
- Preview of HTML shows client’s state (check console for more details).
- Client sends
ping
message to server. - Server every 1s modifies the state.
Context
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
- Colyseus Version: 0.14.23, ws-transport 0.14.21, schema: 1.0.34
- Node.js Version: v14.8.1
- Link to your project: https://codesandbox.io/s/dazzling-mountain-hwzfxh
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 usests-node
orvite-node
to run the server - https://github.com/jog1t/colyseus-issue-510.🎉 What has worked for me is to define a schema class similar to this (see working-solution branch):
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 thesuper()
call returns so the property defined in theSchema
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.