MCPcopy Index your code
hub / github.com/codeaashu/claude-code / connect

Function connect

src/server/web/public/terminal.js:8838–8864  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8836 return url.toString();
8837}
8838function sendJSON(msg) {
8839 if ((ws == null ? void 0 : ws.readyState) === WebSocket.OPEN) ws.send(JSON.stringify(msg));
8840}
8841function connect() {
8842 setStatus("connecting");
8843 ws = new WebSocket(getWsUrl());
8844 ws.addEventListener("open", () => {
8845 connected = true;
8846 reconnectDelay = RECONNECT_BASE_MS;
8847 setStatus("connected");
8848 hideOverlay(loadingOverlay);
8849 hideOverlay(reconnectOverlay);
8850 fitAddon.fit();
8851 sendJSON({ type: "resize", cols: term.cols, rows: term.rows });
8852 startPing();
8853 });
8854 ws.addEventListener("message", ({ data }) => {
8855 if (data.startsWith("{")) {
8856 try {
8857 handleControlMessage(JSON.parse(data));
8858 return;
8859 } catch {
8860 }
8861 }
8862 term.write(data);
8863 });
8864 ws.addEventListener("close", onDisconnect);
8865 ws.addEventListener("error", () => {
8866 });
8867}

Callers 3

scheduleReconnectFunction · 0.70
manualReconnectFunction · 0.70
terminal.jsFile · 0.70

Calls 9

fitMethod · 0.80
setStatusFunction · 0.70
getWsUrlFunction · 0.70
hideOverlayFunction · 0.70
sendJSONFunction · 0.70
startPingFunction · 0.70
handleControlMessageFunction · 0.70
parseMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected