Cloudflare Workers integration is now possible

Today, Cloudflare announced their support for TCP sockets in Workers, along with day-1 support for Postgres.

I would love to see some form of first class support, either in the main package or through another package, but I can’t think of a good way to do this (aside from forking the Node driver). I took a look at Postgres’ solution here; they check if net.Socket exists, otherwise the Cloudflare implementation is used instead. Seems straightforward, there might be a more elegant way to make that check.

What are other peoples’ thoughts on this? Would something like this be worth a pull request?

Hey @Cole_Crouter, I’m the Product Manager for the Node.js Driver so I’d be happy to chime in here.

Our engineers provided early feedback on the Socket API design, however we have not yet completed a review of the final product Cloudflare released this week.

This is something we are reviewing in detail and plan to share more information on as we progress. We always welcome feedback and participation from the developer community, so if you have ideas either open a ticket in our Jira under the NODE project or continue to ask questions here on our forums.