cleanup method

void cleanup()

Clean up transport subscriptions and packet buffer.

@api private

Implementation

void cleanup() {
  _logger.fine('cleanup');

  var subsLength = subs.length;
  for (var i = 0; i < subsLength; i++) {
    var sub = subs.removeAt(0);
    sub.destroy();
  }

  packetBuffer = [];
  encoding = false;
  lastPing = null;

  decoder.destroy();
}