Open cjimenezsaiz opened 3 years ago
@cjimenezsaiz Could you submit a PR?
cc @gnought
Yes, here you have it #625
@cjimenezsaiz It is intended to remove aedes Typescript definition, as we don't require to inherit all EventEmitter methods for aedes operations. The basic is what your user cases are to unsubscribe the events?
@gnought Aedes has several events and handlers that allow to implement very specific functionality, especially for client connection control or publication control, this handlers are assigned when you instantiate the class, so to change one of this strategies in runtime, you need instantiate a new one (of course there is other patterns, but strategy is the most common), if you don't unsubscribe from events, you will create memory leaks.
System Information
Describe the bug From the PR #596, where TypeScript types were refactored, Aedes interface does not extends EventEmitter, but declare
on
interface to subscribe to each event. With this new types declaration is not possible to unsubscribe (without tricks) from the events in a TypeScript code that uses aedes.To Reproduce In a TypeScript application try to use any EventEmitter method, except
on
.Expected behavior Aedes interface should extends EventEmitter in types declaration
Additional context Aedes in Typescript application