publishSample method

void publishSample(
  1. List<Object?> channels
)

Publishes a sample using the binary framing.

Implementation

void publishSample(List<Object?> channels) {
  final slot = _slot;
  if (slot == null || _disposed || !_started || paused) return;
  connection.publishSample(
    WsSampleFrame.encode(
      dataType: config.dataType,
      streamSlot: slot,
      srcSlot: slot,
      // PeerClock, not DateTime.now(): the receiver reads this to measure
      // transit, and a wall clock can be stepped by NTP mid-session, which
      // would surface as a latency spike that never happened.
      senderMicros: PeerClock.nowMicros().toDouble(),
      channels: channels,
    ),
  );
}