Because Diarkis is decentralized, you may need to operate on rooms that are not on the same server process. Here, we explain how to manipulate room properties that are not on the same server process.
By using Diarkis’ internal communication mechanism mesh, you can read and/or update remote room properties.
Sending Update Command To The Server Node Where The Target Room Is
// This sets up handleRemoteRoomPropUpdate function to be invoked when mesh.SendRequest sends// The command message as shown abovemesh.Command(cmdID, handleRemoteRoomPropUpdate)funchandleRemoteRoomPropUpdate(req map[string]interface{}) (error, map[string]interface{}) { roomID := mesh.GetString(req, "roomID")var err error _ := room.UpdateProperties(roomID, func(props map[string]interface{}) bool {if _, ok := props["booked"]; !ok { props["booked"] =true// Booked the room successfullyreturntrue }// The room has already been booked... err = errors.New("Room has already been booked")returnfalse }) res :=make(map[string]interface{})return res, err}