Unstable implentation of websocket and channel protocol

Moved globals to modules, prepared everthing for modularization and alpha release