Пример #1
0
        /// <summary>
        /// Attach the client to the message reader and starts to read messages
        /// </summary>
        public void Attach(HorseClient client)
        {
            client.MessageReceived += ClientOnMessageReceived;

            lock (_attachedClients)
                _attachedClients.Add(client);
        }
Пример #2
0
        /// <summary>
        /// Detach the client from reading it's messages
        /// </summary>
        public void Detach(HorseClient client)
        {
            client.MessageReceived -= ClientOnMessageReceived;

            lock (_attachedClients)
                _attachedClients.Remove(client);
        }
Пример #3
0
 /// <summary>
 /// Reads the received model, if there is subscription to the model, trigger the actions.
 /// Use this method when you can't attach the client easily or directly. (ex: use for connections)
 /// </summary>
 public void Read(HorseClient sender, HorseMessage message)
 {
     ClientOnMessageReceived(sender, message);
 }