How is polling not superior to push for messaging?

The problem is, when you are polling, the interval you poll at determines how responsive your web app will be

So if you poll via ajax every 20 seconds, then it wil be (on average) 10 seconds before new content can be displayed to the client.

You mention web sockets have a heartbeat every 30 seconds. This may be true, I don't honestly know. There is certainly some heartbeat going on, and maybe its adaptive before it's considered disconnected.

But the point is, if a websocket server does emit data to the client, then it is available instantly (ignoring tcp/latency factors), rather than at the next 20 second polling interval (which would be true if you were polling via ajax).

Your points about increased complexity are accurate, but not relevant IMO, since the question was about scaling and performance. Software which can scale is invariably more complex to develop (and maintain).

Bear in mind that when we talk about stateful vs stateless, it does not necessarily refer to stateful at the TCPIP layer (which HTTP is not), but more likely at the application layer (which can be, without necessarily involving a persistent socket connection)

/r/webdev Thread