Network Communication API Editor’s Draft
published: November 23rd, 2007
To enable Web applications to communicate using TCP this specification introduces the TCPSocket interface and a corresponding optional security model.
var con = null;
try {
con = new TCPSocket("www.example.com, "12345");
}
catch (ex) {
if ("SECURITY_ERR" == ex.message) {
alert("unable to connect")
}
}
con.addEventListener("socketdata", function(ev) {
if ("pong" == ev.data) { alert("Success"); }
else { alert("Failure"); }
}
con.write("ping");
con.flush();
The TCPSocket interface enables a TCP connection from the client to the server from which the script was downloaded and executed from. Instances of this object can be made using a constructor on the Window object. W3C
Cool stuff!
Great, the last thing the world needs is yet another way of sending raw TCP data. On the other hand, Java and Flash do this already…