refactored the web-client to use EventEmitter