addSample method

void addSample(
  1. NT4Topic topic,
  2. dynamic data, [
  3. int? timestamp
])

Add a sample of data for a given topic

The data supplied should match the type of the topic when it was published.

timestamp should not be specified

Implementation

void addSample(NT4Topic topic, dynamic data, [int? timestamp]) {
  timestamp ??= _getServerTimeUS();

  _lastAnnouncedValues[topic.name] = data;
  _lastAnnouncedTimestamps[topic.name] = timestamp;

  _wsSendBinary(
      mp.serialize([topic.pubUID, timestamp, topic.getTypeId(), data]));
}