Decentraland HTTP-REST State Synchronization
Update 2020-01-23: Decentraland changed the API since this example. I’ll post an updated link if I port this.
Developers and designers of Decentraland scenes will have a need to synchronize state across all players who are viewing(or inside) a scene.
Previously I discussed doing this with WebSockets but we don’t always want to use WebSockets. There’s extra processing power required with WebSockets that we can avoid by using HTTP-REST.
The interface is like this:
- GET /api/pixels
- get all pixels
- GET /api/pixels/pixel/?x=6&y=4
- get a single pixel at {x,y} coordinate from db
- PUT /api/pixels/pixel
- put a new pixel into the db
- POST /api/pixels/pixel/:id
- post an existing pixel back into the db
- DELETE /api/pixels/pixel/:id
- delete existing pixel
That’s how we “draw” the pixels using REST.
Decentraland
https://decentraland.org
Decentraland Docs - Great tutorials!
https://docs.decentraland.org/
Decentraland CLI:
https://github.com/decentraland/cli