unsubscribe method
Implementation
@override
Future<void> unsubscribe(String topic) async {
_checkInitialized();
String id = topicMap!.get(topic);
// print('Unsub from id: $id');
try {
await jsonRPC.sendRequest(
_buildMethod(JSON_RPC_UNSUBSCRIBE),
{
'topic': topic,
'id': id,
},
);
} catch (e) {
onRelayClientError.broadcast(ErrorEvent(e));
}
// Temove the subscription
pendingSubscriptions.remove(topic);
await topicMap!.delete(topic);
// Delete all the messages
messageTracker!.deleteSubscriptionMessages(topic);
}