diff --git a/agent/main/lib/WebsocketTransport.ts b/agent/main/lib/WebsocketTransport.ts index 4a3df9b5..55b0df07 100644 --- a/agent/main/lib/WebsocketTransport.ts +++ b/agent/main/lib/WebsocketTransport.ts @@ -4,65 +4,6 @@ import * as WebSocket from 'ws'; import EventSubscriber from '@ulixee/commons/lib/EventSubscriber'; import IConnectionTransport from '../interfaces/IConnectionTransport'; - -// export class PortTransport implements IConnectionTransport { -// isClosed = false; - -// connectedPromise = new Resolvable(); -// client: any; - -// public onMessageFn: (message: string) => void; -// public readonly onCloseFns: (() => void)[] = []; - -// constructor(urlPromise: Promise) { -// urlPromise -// .then(url => this.connect(url)) -// .catch(error => { -// if (!this.connectedPromise.isResolved) this.connectedPromise.reject(error); -// }); -// } - -// send(message: string): boolean { -// if (this.client) { -// this.client.send(message); -// return true; -// } -// return false; -// } - -// close(): void { -// if (this.isClosed) return; -// this.isClosed = true; -// } - -// private emit(message): void { -// if (this.onMessageFn) { -// setImmediate(this.onMessageFn, message); -// } -// } - -// private onData(message: string): void { -// this.emit(message); -// } - -// private connect(url: string): void { -// const client = new WebSocket(url); - -// client.onerror = () => { -// if (!this.connectedPromise.isResolved) -// this.connectedPromise.reject(new Error('Failed to connect')); -// }; -// client.onopen = () => { -// this.client = client; -// client.onmessage = e => { -// const msgData = e.data; -// this.onData(msgData); -// }; -// if (!this.connectedPromise.isResolved) this.connectedPromise.resolve(); -// }; -// } -// } - const { log } = Log(module); export class WebsocketTransport implements IConnectionTransport {