Callbag listenable source that connects using nodejs net.Socket interface.
Read more about the Callbag standard here.
// see: ./example/client.js
import { Client } from 'callbag-net'
import { createServer } from './server.mjs'
import { pipe, forEach } from 'callbag-basics-esmodules'
const source = Client({ port: 1234, host: 'localhost' })
createServer(1234, 'hello')
pipe(
source,
forEach(v /* Buffer */ => {
console.log(v)
console.log(v.toString())
})
)
<Buffer 68 65 6c 6c 6f>
hello
Client(options: net.SocketConnectOpts, connectionListener?: (() => void))