Hey all, thanks for the awesome work on this project. I would like to implement something similar to this C# port but for Golang. My knowledge of CRDTs is rather limited so I wanted to ask what specific literature/resources I should consume before starting, and if there are any other gotchas or nuances I should know.
Watch anything you can find from Martin Kleppmann, he also explains very well all of this stuff. Watch his presentations of Automerge.
Keep in mind that strings in JS are UTF-16 and in Go they are UTF-8, so YJS’s concept of length for string items will not be compatible with native Go strings. You’d probably have to convert them to UTF-16 or do some other trickery. YJS keeps strings as UTF-16 at runtime, and converts them to UTF-8 during encoding.
Beware that YJS has 2 different encoding formats (v2 is more compact), so you have to decide on whether to implement both, or only one of them.
Awesome thanks! I’ve already checked out the Y.js internals document and I watched a few Martin Kleppman videos on CRDTs and watched his course on distributed systems. The Braid meetings look great, will definitely give them a watch.
And thank for the heads up on the discrepancy between Go’s and JS’s string encoding, my final goal is to build a Y.js websocket server in Go… so the interoperability between the two languages is important.
Right now I’m naively porting the JS code to Go, as close to the original as Go allows. Mostly as an exercise to become acquainted with the codebase. It’s obviously not the best way of doing things, but hopefully I can get a minimal working version out soon. Cheers
If you have a repo going would love to help.
I am using tinygo to cross compile to wasm and then building the gui with golang and gioui.
my github handle is “gedw99”
to make web sockets calls between the client and the server, need to use websocket package - nhooyr.io/websocket - pkg.go.dev. Its the only one that works with golang wasm.
works great with gioui too.
with golang types on both sides its really nice.
and debugging is easy.