WebSocket

<h3>Server</h3>

connection

write

send

on

emit

<h3>Client</h3>

var exampleSocket = new WebSocket("ws://www.example.com/socketserver", "protocolOne");

On return, exampleSocket.readyState is CONNECTING. The readyState will become OPEN once the connection is ready to transfer data.

If you want to open a connection and are flexible about the protocols you support, you can specify an array of protocols

- this stuff is optional

exampleSocket.onmessage = function(event) { event.data }