javascript sockets listener