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

if this is why we pass pending in I think the parent actor could do this in `case Terminated(actor) if actor == socket =>`