change from throw error too error emitting in channel.js and server.js