(conn: Duplex)
| 183 | } |
| 184 | |
| 185 | const rawDuplexClient = (conn: Duplex): RawClient => { |
| 186 | const counter = makeReadCounter() |
| 187 | conn.on("data", (chunk: Buffer) => counter.push(chunk.length)) |
| 188 | return { |
| 189 | write(frames) { |
| 190 | let flushed = true |
| 191 | for (const frame of frames) flushed = conn.write(frame) |
| 192 | return flushed ? Promise.resolve() : once(conn, "drain").then(() => {}) |
| 193 | }, |
| 194 | read: counter.read, |
| 195 | close: () => conn.destroy() |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | interface SocketClient { |
| 200 | readonly write: (frames: NonEmptyReadonlyArray<Uint8Array>) => Effect.Effect<void> |
no test coverage detected