5 ms·
Does Google do something like this for their servers for the chat service inside gmail? I've noticed it can keep http connections open for extremely long times
by _ck_ 17y ago
Does Google do something like this for their servers for the chat service inside gmail?
I've noticed it can keep http connections open for extremely long times.
- axod 17y agohttp://en.wikipedia.org/wiki/Comet_(programming) http://en.wikipedia.org/wiki/Comet_(programming) is a good ref. Gmail chat does this.
- gcb 17y agoThis wiki page covers mostly the frontend part. The link covers a server side message passing interface. I just glanced over it (do not use nginx) think it's just a more efficient way for your idle process to know if they need to send anything over the wire or if they can keep idleing.
- labria 17y agoThe nginx module is ideal for heavy frameworks like rails, so that you can handle clients waiting for chat messages (for example) on the web server, and not by the heavy framework dispatchers.
- wizard_2 17y agoI do use nginx. This uses a "Simplish HTTP Push Relay Protocol". It's a way for your app (via curl or any other http library) to "connect" to your http clients. It has a few interesting options. "messages" are passed by a "channel id" and you can have any number of long polling listeners on a channel, or you can error out the first or last connections on a channel so there is only one listener at a time. If you have multiple listeners the message becomes a broadcast. You also have a configurable amount of memory to buffer messages in the event there is no listener on a channel, or the listener is busy (receiving a message I guess). You can also set limits on number of messages per channel and a timeout. I can see the advantages of this easily. The connections in nginx are much less resource intensive then a rails or php fast-cgi. You'll end up using much less ram. I know python has twisted and there are few others webservers for other languages, but this would allow me to run a php based chat server and take advantage of long polling. I like it.