-
-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remoteRoomCall: force JSON serialization on local (same-process) calls
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
151668b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why force JSON serialization?
I could pass a class type as an arg to remoteRoomCall before, but now I can't :(
151668b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @WeroldFrannie, it was never intended to allow passing complex structures from
remoteRoomCall
.This method is meant for communicating across different Node.js processes. When the remote room lives on a different Node.js process every argument is going to be encoded. Forcing JSON serialization is a way to avoid unexpected behavior in both scenarios (same process, or on a different process)
I believe you could come up with your own structure if you'd like to pass complex objects between rooms, although I wouldn't recommend that because that won't work when scaling your system
151668b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your reply.
I had code design like this
Maybe it's too complex that I should modify the design to satisfy the new update. 😭