Basic chat server using websockets - from https://gist.github.com/martinsik/2031681