Thank you! Our backend server is an Elixir (Phoenix) server. It has a separate Elixir process for every current live room, we store all state in Redis. So in case we do a rolling deploy we won't drop any connections and continue where we stopped.
The server is mostly responsible for keeping all room state (the editors, the owner, operations per module) and transforming operations. When an operation comes in at the server, like an insertion, the server will check what revision that operation is at and transform it accordingly if the sent operation is based on outdated code. Then that operation will be broadcasted to the clients and again transformed on the clients to handle any inconsistency.
The library we use for doing the transformations is called ot_ex.
I hope this quick view is clearly written, let me know if there are any other questions!
Congrats on shipping something so awesome in so little time!
Also thanks for this writeup. You recently migrated your servers to Kubernetes, right? What learning resources would you recommend for deploying a Phoenix app to k8?
If it is too time consuming to answer my questions, don't worry. The most important part of this message is thank you for building codesandbox. It makes the web a better place.
I learned most from the official Kubernetes tutorials (https://kubernetes.io/docs/tutorials/). I also used mix_docker (https://github.com/Recruitee/mix_docker) as a reference on how to build the image. The advantage of Kubernetes is that you can have the same way to deploy for all servers, so if you learn how Kubernetes deploys you automatically know how to deploy Phoenix applications.
The server is mostly responsible for keeping all room state (the editors, the owner, operations per module) and transforming operations. When an operation comes in at the server, like an insertion, the server will check what revision that operation is at and transform it accordingly if the sent operation is based on outdated code. Then that operation will be broadcasted to the clients and again transformed on the clients to handle any inconsistency.
The library we use for doing the transformations is called ot_ex.
I hope this quick view is clearly written, let me know if there are any other questions!