generate environment.js from the server; start organizing client code a little
partial websocket wrapper implementation