I want to use the net
module from Node.js on the client side (in the browser):
var net = require(\'net\');
So I looked up how
This is because net
gives you access to raw TCP sockets - which browsers simply cannot do from the JavaScript end. It is impossible for net
to ever be ported to the client side until such an API is written (allowing arbitrary tcp traffic).
Your best bet if you want to send tcp data from the client to the server is using web sockets using the socket.io module or the ws one.
Your best bet if you want clients to communicate directly is to look into WebRTC