Ask coding questions

← Back to all posts
How can a server ping the web client on demand

I am planning on making a chat service where when a message is sent, it immediately displays on everyone's HTML client, but the only way I could think of to do that would be a constant stream of requests from the client to the server. But what I think would be better would be like a reverse XHR request, the request only happening when the server gets a new message. I have seen this in action with SOCKET.IO, but how do they do it.