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

Function onMessage

packages/effect/src/socket/Socket.ts:1084–1093  ·  view source on GitHub ↗
(event: WebSocketEvent)

Source from the content-addressed store, hash-verified

1082 }
1083
1084 function onMessage(event: WebSocketEvent) {
1085 const data = event.data as Uint8Array | ArrayBuffer | Blob | string
1086 if (typeof Blob !== "undefined" && data instanceof Blob) {
1087 data.arrayBuffer().then((buf) => push(new Uint8Array(buf)), (cause) => {
1088 fail(new SocketError({ reason: new SocketReadError({ cause }) }))
1089 })
1090 return
1091 }
1092 push(data instanceof ArrayBuffer ? new Uint8Array(data) : data as Uint8Array | string)
1093 }
1094 function onError(event: WebSocketEvent) {
1095 fail(
1096 new SocketError({

Callers 5

Redis.test.tsFile · 0.50
dispatchFunction · 0.50
runFunction · 0.50
"~fire"Method · 0.50
bridgeFunction · 0.50

Calls 3

pushFunction · 0.70
failFunction · 0.70
arrayBufferMethod · 0.45

Tested by 1

dispatchFunction · 0.40