This actually sounds like how you would do this in Erlang - and it's really elegant because WebSockets/Server-Sent Events are simply encapsulated in processes spawned when the request is received. I don't know if this is how Erlang webservers actually work, but this is how I'd do it.