updated to use new stream interface for servers and web sockets
fixed indentation