6

I've seen many questions about using raw TCP/UDP sockets in web browsers using JavaScript/Html5 however they are all old like this one posted 5 years ago. It is now 2021 and I'm wondering if there is any possibility at all to avoid using WebSockets and instead use raw TCP/UDP sockets so my local Web page can talk with my local Python socket server.

I don't mind if it's not accessible via internet, or if I need an extension as it's only for a home project where a web page on my Raspberry Pi zero will communicate with my main computer to request data via its Python socket server.

I know that Chrome apps had a socket API before the apps were dropped and I saw this article about Chromium devs wanting to add sockets, but failed to find any real info about it.

Does anyone know of any way to use raw TCP/UDP sockets in a browser?

NaturalBornCamper
  • 3,675
  • 5
  • 39
  • 58
  • 3
    For different security reasons, not to mention the ease with which browsers run untrusted scripts from websites, I doubt if we will **ever** see raw TCP / UDP on a browser. If we do, then initiating a DDoS (Distributed Denial of Service) attack might become too easy for the internet to survive this "feature". – Myst Jan 11 '21 at 18:17
  • It makes sense, however I was hoping that like for Same-Origin AJAX requests, you could somehow allow sockets at your own risk if you chose to. I'll keep waiting in case it gets added at some point then – NaturalBornCamper Jan 15 '21 at 02:20
  • Good luck, Just remember: a feature that can be enabled for some things or under some circumstances can be hacked / abused. A feature that doesn't exist can't ever be hacked... I think you might have a long wait ahead of you. – Myst Jan 16 '21 at 08:56

0 Answers0