I have a server, I wrote it in C #, and the clients, they send all sorts of messages over TCP / IP. Well, I need to come up with something or suggest how to do it right. It is necessary that the request be sent from the server to the client, I know what it is impossible to do, the reason is that, every second or 10 seconds, it is not comfy terebonkat server, take into account the fact that users can reach up to 20-30 at a time. Is it possible to find some alternative?
1 answer
Too little specifics in the question, but if you do not take this into account for the implementation of the client server notification mechanism, the following options come to mind:
Wcf duplex services is a situation in which both the client and the server are both
Service Consumer
andService Provider
, i.e. speaking in simple words, the server has the opportunity to call methods on the client side.Using queues, for example of the same
RabbitMq
(Publish/Subscribe
mode, in fact this mode is a publisher-subscriber pattern), the point is that the client subscribes to certain information (event). What could it be? Yes, anything, for example, we may be interested in any exceptions that occur during the operation of the server side of the application. In this case, when an exception occurs, we (the server) performPublish
and notify all clients who subscribe to this event of its occurrence.
I will add that all these mechanisms work out of the box, i.e. To wisely and invent some crutches and bicycles is not necessary) So look, maybe something from the proposed will suit you.