/// <summary> /// Send message to all connected clients /// </summary> /// <param name="message"></param> public void SendToAll(ChatMessage message) { lock (_connectedClients) { foreach (var client in _connectedClients) { client.Send(message); } } }
/// <summary> /// Send message to all connected clients but me /// </summary> /// <param name="me"></param> /// <param name="message"></param> public void SendToAllButMe(ClientChatConnection me, ChatMessage message) { lock (_connectedClients) { foreach (var client in _connectedClients) { if (client == me) continue; client.Send(message); } } }
public void Send(ChatMessage message) { if (message == null) throw new ArgumentNullException("message"); Context.Write(message); }