MCPcopy Index your code
hub / github.com/callstack/agent-device / acceptWebSocket

Function acceptWebSocket

test/integration/installed-package-metro.test.ts:92–106  ·  view source on GitHub ↗
(socket: Duplex, key: string)

Source from the content-addressed store, hash-verified

90}
91
92function acceptWebSocket(socket: Duplex, key: string): void {
93 const accept = crypto
94 .createHash('sha1')
95 .update(`${key}258EAFA5-E914-47DA-95CA-C5AB0DC85B11`)
96 .digest('base64');
97 socket.write(
98 [
99 'HTTP/1.1 101 Switching Protocols',
100 'Upgrade: websocket',
101 'Connection: Upgrade',
102 `Sec-WebSocket-Accept: ${accept}`,
103 '\r\n',
104 ].join('\r\n'),
105 );
106}
107
108test('installed package exposes Node APIs and packaged companion tunnel entrypoint', async (t) => {
109 const root = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-device-installed-package-'));

Callers 1

Calls 2

updateMethod · 0.80
writeMethod · 0.80

Tested by

no test coverage detected