How to synchronize interactions with game objects?

I'm developing a game with babylon + colyseus. I'm in the process of implementing interactions with room objects (think of chests, machines, etc.)

When a player interacts with an object, that interaction should be synchronized and visible by other players in the room.

I'm familiar with photon PUN and I used to use RPCs to do this kind of stuff. Is there an equivalent system in colyseus?

If not, then I assume I would have to do this by sending a message to the server. The way I want to do this is to create a generic ObjectInteraction message, which takes the unique object name and a boolean (isActivated), and sets the boolean on the server for that object, so that it can be synchronized in the game.

However, I'm stumped as to how to do this. For the moment I'm only accessing a Player schema through client.sessionID.

I feel like I should create a dynamic list of all interactable objects, and setting their isActivated booleans to the relevant values. But I have no idea on how to achieve this.

Any pointers would be appreciated, thanks!

You can use stateful objects (Schema) and subscribe for its changes. At client side, when an object hits another object for example, you can send a message to server and let server decide if it's valid or not, if yes it will update involved objects