示例#1
0
        public async Task PublishSensorData(string sensorName, IAsyncEnumerable <string> msgData)
        {
            try
            {
                await foreach (var measurement in msgData)
                {
                    _sensorCollection.PublishSensorData(sensorName, measurement);
                }
            }
            finally
            {
                await Clients.All.SendAsync("StreamRemoved", sensorName);//function on client Hub

                _sensorCollection.DisconnectSensor(sensorName);
            }
        }