Network messaging

I'm currently trying to develop a message-oriented network environment, and I'm a little fixated on the internal mechanism.

Here are the problematic interfaces:

public interface IMessage
{
}


public class Connection
{
    public void Subscribe<TMessage>(Action<TMessage> messageCallback);
    public void Send<TMessage>(TMessage message);   
}

The method Senddoes not seem complicated, although the mechanism Subscribeseems a little more painful. Obviously, when I receive a message at one end of the connection, I will have to call the appropriate delegate. Do you have any tips on how to read messages and easily detect their types?

By the way, I would like to avoid using MSMQ.

+3
source share
1 answer

Source: https://habr.com/ru/post/1745295/


All Articles