MCPcopy Create free account
hub / github.com/Effect-TS/effect / push

Function push

packages/effect/src/socket/Socket.ts:1038–1050  ·  view source on GitHub ↗
(data: Uint8Array | string)

Source from the content-addressed store, hash-verified

1036 }
1037
1038 function push(data: Uint8Array | string) {
1039 if (overflowed) return
1040 buffer.push(data)
1041 if (highWaterMark !== undefined) {
1042 bufferSize += (typeof data === "string" ? encoder.encode(data).byteLength : data.byteLength) || 1
1043 }
1044 if (waiter !== undefined) deliver()
1045 if (pausable && bufferSize >= highWaterMark!) {
1046 pauseWebSocket()
1047 } else if (!pausable && bufferSize > highWaterMark!) {
1048 overflow()
1049 }
1050 }
1051
1052 function overflow() {
1053 overflowed = true

Callers 1

onMessageFunction · 0.70

Calls 5

pauseWebSocketFunction · 0.85
overflowFunction · 0.85
encodeMethod · 0.80
deliverFunction · 0.70
pushMethod · 0.65

Tested by

no test coverage detected