I did this function on an esy.es server:
<script>
net=new WebSocket("ws://tatopatato.esy.es/chat12.htm")
</script>
And I get an error:
Firefox can not establish a connection to the server at ws: //tatopatato.esy.es/chat12.htm.
Something similar happens in chrome, also if I put this:
<body bgcolor="black">
<script>
name=prompt("Enter your name, please.")
net=new WebSocket('ws://html5rocks.websocket.org/echo')
net.onmessage=function(){e.data}
net.onconnect=function(){net.send(console.log("User: "+name+" has connected"))}
onkeydown=function(){net.send(console.log(prompt("Enter your message.")))}
</script>
</body>
It's funny, because when I send a message it does not respond. What do I do to make it work?