Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: onBeforePatch callback for Room #385

Closed
tonygiang opened this issue Dec 5, 2020 · 3 comments · Fixed by #461
Closed

Feature request: onBeforePatch callback for Room #385

tonygiang opened this issue Dec 5, 2020 · 3 comments · Fixed by #461
Assignees
Milestone

Comments

@tonygiang
Copy link

tonygiang commented Dec 5, 2020

I'm requesting an additional onBeforePatch callback that would be called right before each time the room state is sent to the clients in a room. This allows us to modify or read the room state before it is synchronized. Use case: error-correction, server-controlled AI behaviour, analytics logging, other automated processes that can be plugged in/out at will on runtime.

Implementation question: could this callback be awaited under the hood?

@endel
Copy link
Member

endel commented Dec 5, 2020

Hi @tonygiang,

Sounds like this could be helpful indeed! You are referring to the addition of onBeforePatch on the client-side, right?

Allowing to also await for onBeforePatch would complicate things - as we'd need to handle a queue of incoming messages internally while onBeforePatch hasn't finished.

I agree on having an onBeforePatch without the await lock

@tonygiang
Copy link
Author

I'm referring to the addition of onBeforePatch on the server-side. State patching is server-authoritative, after all.

@endel endel added this to the 0.15 milestone Mar 19, 2021
@endel endel added this to 📚 Backlog in Next version (0.15) via automation Aug 19, 2021
@lpsandaruwan lpsandaruwan self-assigned this Oct 18, 2021
@endel endel moved this from 📚 Backlog to ⏳ In progress in Next version (0.15) Oct 27, 2021
@endel
Copy link
Member

endel commented May 5, 2023

Landed on 0.15 https://docs.colyseus.io/server/room/#onbeforepatch

@endel endel closed this as completed May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Next version (0.15)
⏳ In progress
Development

Successfully merging a pull request may close this issue.

3 participants