Search code examples
c#delphichattheory

Pushlet, Long polling or polling - Which one should I use in my chat application?


I have to develop a multiple users chat application (like msn). I don't what to use any framework to build it because I want to learn how those things work.

I am developing it in Delphi or C# but it does not really matter. What matter is that the chat client is going to be an app, not a browser.

The question is: what is the best way of handling messages between the clients?

So far, I know those techniques:

Pushlet

Polling

Long polling

Link to the Wikipedia


Solution

  • Do you need to support (tens of) thousands of simultanous connections? If yes, I recommend to take a look at

    which are used in application servers and standards like Servlet 3.0 to minimize the number of worker threads and speed up network operation

    There is a IOCP library for Delphi - see Is there a I/O completion port based component for Delphi?

    Also HTTP could be used as the internal protocol, the new Microsoft http.sys library provides a great foundation and is included with new versions of Windows.

    To give an impression how efficient messaging servers can be: on relatively modest hardware, the open source ActiveMQ Apollo server can handle 1.2 million messages per second. (It is written in Java)