Requirements:

  1. Chat two customers
  2. Group talk
  3. Receive offline messages
  4. Preservation of history (actually, follows from the third paragraph)
  5. Requirements that are not related to the question: registration, authorization through third-party services (google, ms live), the user can specify additional. information about yourself, receiving / transmitting files directly between clients and through the server.

The task as a whole is of sports interest. Suppose that customers will be up to 10k, the application itself will develop and will need to be supported.


I can not decide how to make it more convenient:

  1. Poll server constantly for changes
  2. Maintain a permanent socket connection

The problems with the first option are very resource intensive. Each request must be validated, frequent access to the database.

The second option is difficult to implement and support. Actually, there is such an idea: deploy a wcf-service, send messages through it (like a SendMessage(message, userId) ). In addition, provide also a connection point to the socket, which already deliver this message to the recipient.

That is, the client's actions: logged in -> connected to the socket -> sent a message through the wcf-service

wcf-service: received a message -> found the "socket-connection" of the recipient -> sent a message via tcp


Actually, what is easier to maintain and what is “cheaper” - thousands of TCP connections or thousands of thousands of requests to the server?

Thank you very much in advance!

ps. you probably shouldn't offer the state connection of a wcf service. The end client should work on several platforms + I have read a lot of bad things about them.

  • one
    I will not say anything concrete, just give a link to the java server - client. So for general interest inetjava.sourceforge.net/lectures/part1_sockets/… - Deadkenny
  • Or maybe take a ready jabber server? they support almost everything that is listed. - KoVadim
  • @KoVadim, then the sport interest is lost;) - Walter Nuss
  • take on a look. Then, writing your decision, compare, potestit. - KoVadim

1 answer 1

It seems to me that for 10k users it would be better to use not WCF, but some sort of messaging service ala NServiceBus, Nancy or ServiceStack. In addition, they are more tolerant of errors and they (as far as I know) are easier to catch (errors). It seems to me that this is an ideal and resource-efficient option for this type of task. In addition, you will receive another bonus in the scalability of the application. It will be easier to divide into modules and