Closed fedyk closed 11 months ago
Currently, after creating an instance of MTProto, there are no easy way to destroy instance (close open ws/socket connections and remove listeners).
Here I added a destroy method. The usage is following:
destroy
// 1. Create instance const mtproto = new MTProto({ api_id, api_hash, storageOptions: {...}}); // 2. Call any method(-s) mtproto.call('help.getNearestDc').then(result => ...}); // 3. Destroy: close open connections, reject pending requests, cleanup event's listeners mtproto.destroy()
Please tell me, can these edits be merge to the master? Need a destroy method. Thanks
@alik0211 can you please merge it?
Currently, after creating an instance of MTProto, there are no easy way to destroy instance (close open ws/socket connections and remove listeners).
Here I added a
destroy
method. The usage is following: