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

Method connect

src/remote/RemoteSessionManager.ts:108–141  ·  view source on GitHub ↗

* Connect to the remote session via WebSocket

()

Source from the content-addressed store, hash-verified

106 * Connect to the remote session via WebSocket
107 */
108 connect(): void {
109 logForDebugging(
110 `[RemoteSessionManager] Connecting to session ${this.config.sessionId}`,
111 )
112
113 const wsCallbacks: SessionsWebSocketCallbacks = {
114 onMessage: message => this.handleMessage(message),
115 onConnected: () => {
116 logForDebugging('[RemoteSessionManager] Connected')
117 this.callbacks.onConnected?.()
118 },
119 onClose: () => {
120 logForDebugging('[RemoteSessionManager] Disconnected')
121 this.callbacks.onDisconnected?.()
122 },
123 onReconnecting: () => {
124 logForDebugging('[RemoteSessionManager] Reconnecting')
125 this.callbacks.onReconnecting?.()
126 },
127 onError: error => {
128 logError(error)
129 this.callbacks.onError?.(error)
130 },
131 }
132
133 this.websocket = new SessionsWebSocket(
134 this.config.sessionId,
135 this.config.orgUuid,
136 this.config.getAccessToken,
137 wsCallbacks,
138 )
139
140 void this.websocket.connect()
141 }
142
143 /**
144 * Handle messages from WebSocket

Callers 1

useRemoteSessionFunction · 0.95

Calls 4

handleMessageMethod · 0.95
logForDebuggingFunction · 0.85
onErrorMethod · 0.80
logErrorFunction · 0.50

Tested by

no test coverage detected