(handler: (_: Uint8Array) => Effect.Effect<_, E, R> | void, opts?: {
readonly onOpen?: Effect.Effect<void> | undefined
})
| 451 | |
| 452 | const encoder = new TextEncoder() |
| 453 | const run = <R, E, _>(handler: (_: Uint8Array) => Effect.Effect<_, E, R> | void, opts?: { |
| 454 | readonly onOpen?: Effect.Effect<void> | undefined |
| 455 | }) => runRaw((data) => typeof data === "string" ? handler(encoder.encode(data)) : handler(data), opts) |
| 456 | |
| 457 | return Socket.Socket.of({ |
| 458 | [Socket.TypeId]: Socket.TypeId, |