Maps
A Map is a distributed key-value store. Maps can contain other maps or lists, resolve conflicts automatically, and update in real-time. When you update a map, it updates optimistically and forwards the message to everyone else in the room in the background.
If you have a room setup, you can create a map:
1let map = room.map("vector")
Like in other parts of Room Service, you should manually listen for updates via the room:
1room.subscribe(map, m => {2 // m is a new, efficient copy with the update applied3})
Maps work like many immutable libraries; every update returns a new, efficient copy of the map:
1map = map.set("color", "blue")2map = map.delete("color")
To get stuff out of maps, use get:
1color = map.get("color")