6

I saw that Socket.IO and Websockets usually require NodeJS or similar but don't run on clients.

Is there any possible way to open a port for accepting communications using JavaScript? So devices can talk to each other on a network, peer2peer (acting like a server)?

Kevin Van Ryckegem
  • 1,915
  • 3
  • 28
  • 55

1 Answers1

6
  1. You can't use real TCP or UDP sockets in the browser.
  2. You may use WebSockets to communicate to a server which translates WebSocket connection to real socket connection. Server may be written in NodeJS or other language/platform.
  3. You can't listen for connections with WebSockets.
  4. You also may use WebRTC, which is also different from sockets, but better suited for peer-to-peer networks (I don't know very much about it).
Community
  • 1
  • 1
ilyaigpetrov
  • 3,657
  • 3
  • 30
  • 46