How can I communicate over TCP sockets from JavaScript?

Solution 1:

WebSockets is designed to solve this problem.

Solution 2:

Here is an implementation with a similar approach:

  • socketjs

It uses a Java Applet and bridges its API to JavaScript, interesting...

And here another one:

  • jSocket

This one is a wrapper of the Actionscript 3 Socket API, bridged to JavaScript...

Solution 3:

You can use node.js framework's socket.io package which can can be installed via npm (A node package manager).

More detailed usage.