MCPcopy Create free account
hub / github.com/codeaashu/claude-code / data

Function data

src/upstreamproxy/relay.ts:196–214  ·  view source on GitHub ↗
(sock, data)

Source from the content-addressed store, hash-verified

194 sock.data = { ...newConnState(), writeBuf: [] }
195 },
196 data(sock, data) {
197 const st = sock.data
198 const adapter: ClientSocket = {
199 write: payload => {
200 const bytes =
201 typeof payload === 'string'
202 ? Buffer.from(payload, 'utf8')
203 : payload
204 if (st.writeBuf.length > 0) {
205 st.writeBuf.push(bytes)
206 return
207 }
208 const n = sock.write(bytes)
209 if (n < bytes.length) st.writeBuf.push(bytes.subarray(n))
210 },
211 end: () => sock.end(),
212 }
213 handleData(adapter, st, data, wsUrl, authHeader, wsAuthHeader)
214 },
215 drain(sock) {
216 const st = sock.data
217 while (st.writeBuf.length > 0) {

Callers

nothing calls this directly

Calls 4

handleDataFunction · 0.85
pushMethod · 0.45
writeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected