◈ 9ce92808be498e9e05590ff27cbfdfe4
RRC hub: 28c7c1a68c735693aa8e6b8193ed44b2 (join room general)
Forum / General / POST-based interface

POST-based interface

Started by jrl290 ·

I see someone already has a javascript library that uses WebSockets. I think that's great

For fun, I mocked up what I thought could be done using nothing but PHP and standard HTTP ports (AI assisted of course), since that's generally the limitation of shared web hosting.

The key difficulty is the one way nature of POST requests. It's always possible to access the hosted server. It's not possible to dial back to the client. So I took a particular strategy: front and back load the "pull" side of the exchange; reduce the "push"/"poll" side to a "data ready" response.

Between web servers, the "one way" issue isn't a problem. A node can just directly send a "data ready" whenever needed.

Polling of course, isn't awesome. But a lot of "live" connections on webpages do that anyway: including chat programs.

The key link to the concept though is getting data from the PHP host to the standard TCP/IP backbone nodes in order to link everything. That could be done by anyone who has more flexible hosting that could run python on custom ports. Or worst case, a polling daemon could provide a link

I just figured it might be a cheap way to expand the network. For resiliency more than for specific application use

Any thoughts on whether it's worth pursuing? I'm honestly on the fence about it's usefulness

Sojourner 7cafffb51eb97f9f...

Why not just use websockets as the interface? they use the same port as your other http traffic, so there's no limitation there?

Maybe I'm misunderstanding you.

Shared hosting relies on short lived requests. Even if you were to run a php script that establishes a websocket connection, the hosting service may terminate the script if it runs too long. You also wouldn't be able to accept incoming connections while also running an nginx/apache web server since they would tie up the same port

Sojourner 7cafffb51eb97f9f...

Even if you were to run a php script that establishes a websocket connection, the hosting service may terminate the script if it runs too long

Ah, that sucks.

You also wouldn't be able to accept incoming connections while also running an nginx/apache web server since they would tie up the same port

Of course you can. You use / for your regular traffic and /ws for your websockets. Every remotely modern web server can deal with websockets.

Post a Reply

Markdown

Supports Markdown: **bold**, *italic*, `code`, ```code blocks```, [links](url)

Log in to upload images

Proof of work verification for anonymous posting

Copied to clipboard