unsubscribe method

Future<void> unsubscribe(
  1. String destination
)

Implementation

Future<void> unsubscribe(
  String destination,
) async {
  final id = _subscriptionsMap['destination'];

  if (id == null) {
    throw Exception('No subscription found for destination: $destination');
  }
  _tcpClient.add(ClientFrame.unsubscribe(id).toBytes());

  _subscriptionsMap.remove(destination);
  _handlers.remove(destination);
}