MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / createSocket

Function createSocket

src/cm/lsp/transport.ts:76–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74 const encoder = binaryMode ? new TextEncoder() : null;
75
76 function createSocket(): WebSocket {
77 try {
78 // pylsp's websocket endpoint does not require subprotocol negotiation.
79 // Avoid passing protocols to keep the handshake simple.
80 const ws = new WebSocket(wsUrl);
81 if (binaryMode) {
82 ws.binaryType = "arraybuffer";
83 }
84 return ws;
85 } catch (error) {
86 const message = error instanceof Error ? error.message : String(error);
87 throw new Error(
88 `Failed to construct WebSocket for ${server.id} (${wsUrl}): ${message}`,
89 );
90 }
91 }
92
93 function handleMessage(event: MessageEvent): void {
94 let data: string;

Callers 2

attemptReconnectFunction · 0.85
createWebSocketTransportFunction · 0.85

Calls 1

StringInterface · 0.85

Tested by

no test coverage detected