Пример #1
0
 private void SendAll(ChatCommand command)
 {
     foreach (ChatClient client in this.clients.ToArray())
     {
         SendCommand(client.Socket, command);
     }
 }
Пример #2
0
        public void SendCommand(IWebSocketConnection socket, ChatCommand response)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            ChatMessage message = new ChatMessage()
            {
                Type = response.GetName(),
                Command = serializer.Serialize(response),
            };

            string str = serializer.Serialize(message);
            socket.Send(str);
        }