refactor app.js.coffee. websocket now can detect register/unregister actions