setupSendCallback method

void setupSendCallback()

Setup and manage send callback

Implementation

void setupSendCallback() {
  // the message was sent successfully, execute the callback
  onDrain(_) {
    if (sentCallbackFn.isNotEmpty) {
      var seqFn = sentCallbackFn[0];

      seqFn(transport);
    }
  }

  transport.on('drain', onDrain);

  cleanupFn.add(() {
    transport.off('drain', onDrain);
  });
}