You might not even need to implement all of emacs, just emacsclient and have the emacs daemon running on the server.
But why does everything need to run in the browser? You have a perfectly good OS and you can run Emacs natively and use tramp to open remote files over ssh. I do it every day, it's awesome because I'm using my local emacs configured the way I like it and I can edit files on any server that has sshd running. Problem solved.