Beispiel #1
0
        public static void BroadCastInit(DbTable dbTable)
        {
            var clientsToSend = Connections.Get(itm => itm.SubscribedToTable(dbTable.Name)).Select(itm => itm.Client);

            byte[] packetToBroadcast = null;

            foreach (var clientProxy in clientsToSend)
            {
                if (packetToBroadcast == null)
                {
                    packetToBroadcast = dbTable.GetAllRecords(null).ToHubUpdateContract();
                }

                clientProxy.SendAsync(dbTable.Name, "i", packetToBroadcast);
            }
        }
Beispiel #2
0
        public static void BroadcastInitTable(DbTable dbTable)
        {
            var connections = TableSubscribers.GetConnections(dbTable.Name);

            if (connections == null)
            {
                return;
            }

            var packetToBroadcast = new InitTableContract
            {
                TableName = dbTable.Name,
                Data      = dbTable.GetAllRecords(null).ToHubUpdateContract()
            };

            foreach (var connection in connections)
            {
                connection.SendPacket(packetToBroadcast);
            }
        }