Ejemplo n.º 1
0
        /// <inheritdoc />
        public void SendToAll(Messages.Payloads.BaseMessage message)
        {
            var msg = Helper.BuildMessage(message);

            foreach (var client in ConnectedSockets)
            {
                client.Key.Send(msg);
            }
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public void SendToAllExcludeOne(Messages.Payloads.BaseMessage message, IWebSocketConnection exclude)
        {
            var msg             = Helper.BuildMessage(message);
            var filteredSockets = ConnectedSockets.Where(client => client.Key != exclude);

            foreach (var client in filteredSockets)
            {
                client.Key.Send(msg);
            }
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        public void SendToUser(string receiver, Messages.Payloads.BaseMessage message)
        {
            var user = ConnectedSockets.FirstOrDefault(socket => socket.Value.Login == receiver).Key;

            user?.Send(message);
        }