tulios / kafkajs

A modern Apache Kafka client for node.js
https://kafka.js.org
MIT License
3.71k stars 525 forks source link

Support for Cloudflare sockets connect #1713

Open devinrsmith opened 1 month ago

devinrsmith commented 1 month ago

It would be great to be able to connect to kafka from a cloudflare worker; the APIs that the cloudflare workers expose lacks net / tls, and thus https://github.com/tulios/kafkajs/blob/v2.2.4/src/network/socketFactory.js fails.

The following might be useful context in consideration of this feature:

https://github.com/brianc/node-postgres/blob/master/packages/pg/lib/stream.js

https://blog.cloudflare.com/workers-tcp-socket-api-connect-databases

https://developers.cloudflare.com/workers/runtime-apis/tcp-sockets/