Hacker News new | ask | show | jobs
by onefuncman 1627 days ago
what broke?
2 comments

From the site:

> I've had to take this project offline!

> I was expecting it to be abused and violated, but was completely naive to what the internet people were capable of.

> Wow. That's all I can say. It was fun while it lasted, and it'll be back... some time.

I guess it became a test that, as expected, part of the human race failed.

I think it's the server here:

wss://www.walloftext.art/ws.php

Doesn't seem to be accepting connections when I try.

WebSockets in PHP huh? That's a pretty cool approach, although it naturally scales terribly (sadly D:).
You can get it to scale (for a certain definition of scale, of course), though man it was far too much effort.
I empathize and relate.

Out of curiosity, were you actually handling each WebSocket connection using an independent PHP-FPM instance? If so (wow), how many concurrent connections did you manage to sustain at peak?

The only experience I've had using WebSockets with PHP is with using stream_socket_server() et al, and then multiplexing everything. (Then you just get handed the problem of restarting the server(s) to keep runaway GC in check...)

Edit: Have realized you aren't OP - but that's fine, I'm interested to hear war stories from multiple sources!

OP here. There were no scaling issues while this was getting hammered. PHP has native support for sockets, so can handle thousands of connections, no better or worse than any other language. The system buffers up incoming messages and your can read them in an infinite loop. Take a look at the code, and one day I'll put this back online.
Seeing the URL end in .php gave me the wrong impression - I thought it was running a separate PHP interpreter for each connection... which is naturally insane, and why I was curious.

I should've just gone and looked at the code before piping up... and I'm really glad I finally did, because I honestly have to say I'm learning a lot from how succinct this is (while still incorporating PHP 8.x type boilerplate, which I can't deny is an excellent habit to get into!) - I still have How Do I Even Structure This syndrome despite tinkering around for a good decade sadly.

Looking forward to seeing this back online.

If you put it behind a simple account system, only a limited subset of people would be able to access it, and you could tinker and iterate with a real-world user base.

I'm still curious what led to you shutting it down. Something overstepped a boundary, I'm presuming; depending on what that was I might not want to know exact specifics :<