mackalex / pi-control-frontend

0 stars 0 forks source link

Might have to use WebSockets #12

Closed alexhutman closed 1 month ago

alexhutman commented 1 month ago

Fuck.

In the description of this commit (62971a202d18871d31e003d8c3b8b11ff6645f7e), you'll find this link which essentially says we can't directly create TCP connections via the browser on the client side. This makes sense I suppose, but I wonder if we could do anything to salvage using direct TCP connections without having to resort to WebSockets. I'd have to pull in some library like libwebsockets on the backend to support this.

Wait... does Node have direct support for raw socket access?

https://nodejs.org/api/net.html#netcreateconnectionport-host-connectlistener https://stackoverflow.com/a/18664857/6708303

Originally posted by @alexhutman in https://github.com/mackalex/pi-control-frontend/issues/2#issuecomment-2285285181


Don't think so, pal. Well, Node servers do, but not clients in the browser.

alexhutman commented 1 month ago

These 2 examples of libwebsockets might be helpful