Through $DAYJOB, I happened to have a meeting with one of the founders of this company some time ago -- not about Replay, but about a "How do you do this" sort of question. After prying for technical details, Replay came up, and I asked to see it out of curiosity. Really blew my mind. Every once in a while a piece of technology comes around that doesn't quite have an equivalent. I could immediately see where being ab…
> Every once in a while a piece of technology comes around that doesn't quite have an equivalent. I dunno, https://www.rrweb.io/ comes close (closer?) and it's open source. There's also other paid solutions like FullStory and LogRocket.
From: https://www.notion.so/How-Replay-works-cc65abf5eb11443586abb...
So if you can’t capture API calls directly, what do you do? You drop down one level and record the browser system calls. This probably sounds like a terrible idea. We started off with a simple 3 line JS program with one API call and one clock and instead of just recording these two calls, we’re now recording a program with millions of lines of C++ and the complexity of an Operating System. Yep! It’s crazy, but works, and it’s pretty awesome.
So the nice thing about system calls is there are not too many of them and they don’t change that often. This means that instead of recording an API call directly, we can record the network engine’s system calls to open socket and process packets from the server. And by recording at this level, it’s possible to replay the website exactly as it ran before, with the same performance characteristics and everything else. It’s a little bit like putting your browser into “the Matrix” and tricking it into believing everything is normal, when in fact it is just running in a simulation.