Replaces sbt AJAX calls with web socket. Also some refactoring of code.

The idea is that this should work even if we use the serialId as an identifier in sbt server. Atm it doesn't matter but if there are multiple clients to the server and they all use numbers then there could potentially be a clash.