MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / connect

Method connect

src/shared/services/tooling_daemon.ts:59–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57 }
58
59 private async connect() {
60 const dtdUri = await this.dtdProcess.dtdUri;
61 if (!dtdUri)
62 return;
63 const dtdSecret = await this.dtdProcess.dtdSecret;
64
65 this.logger.info(`Connecting to DTD at ${dtdUri}...`);
66 const socket = new ws.WebSocket(dtdUri, { followRedirects: true });
67 attachPing(socket);
68 socket.on("open", () => this.handleOpen());
69 // eslint-disable-next-line @typescript-eslint/no-base-to-string
70 socket.on("message", (data) => this.handleData(data.toString()));
71 socket.on("close", () => this.handleWebSocketClose());
72 socket.on("error", (e) => this.handleError(e));
73
74 this.connection = { socket, dtdUri, dtdSecret };
75 }
76
77 protected async handleOpen(): Promise<void> {
78 this.logger.info(`Connected to DTD`);

Callers 1

constructorMethod · 0.95

Calls 8

handleOpenMethod · 0.95
handleDataMethod · 0.95
handleWebSocketCloseMethod · 0.95
handleErrorMethod · 0.95
attachPingFunction · 0.90
onMethod · 0.80
infoMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected