diff --git a/src/transports/EventEmitterTransport.ts b/src/transports/EventEmitterTransport.ts index 4679389..9b4c0b2 100644 --- a/src/transports/EventEmitterTransport.ts +++ b/src/transports/EventEmitterTransport.ts @@ -2,34 +2,23 @@ import { EventEmitter } from "events"; import ITransport from "./Transport"; class EventEmitterTransport implements ITransport { - public connection: EventEmitter | null; + public connection: EventEmitter; constructor(uri: string) { this.connection = new EventEmitter(); } public connect(): Promise { - // noop return Promise.resolve(); } public onData(callback: any) { - if (!this.connection) { - return; - } this.connection.addListener("message", (data: any) => { callback(data); }); } public sendData(data: any) { - if (!this.connection) { - return; - } this.connection.emit("message", data); } public close() { - if (!this.connection) { - return; - } this.connection.removeAllListeners(); - this.connection = null; } }