Getting server updates

This page demonstrates server-sent events.

I just learned about SSEs a day or two ago – they're surprisingly simple. The idea is that the client requests a web resource as usual, using HTTP, but instead of closing the connection after the page is received, it leaves the HTTP connection open and keeps listening for more data, which it processes as "events" if the server sends anything. If the connection closes, the client keeps trying to open it again.

This should be useful when I make a game, to avoid having to manually refresh to get the latest game state. Anything to avoid using websockets!