/// <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); }
/// <summary> /// Detach the client from reading it's messages /// </summary> public void Detach(HorseClient client) { client.MessageReceived -= ClientOnMessageReceived; lock (_attachedClients) _attachedClients.Remove(client); }
/// <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); }