From 9d602ce5870628cb1101b0234faa96fe18d9419c Mon Sep 17 00:00:00 2001 From: George MacKerron Date: Tue, 28 Jan 2025 10:34:42 +0000 Subject: [PATCH] Minor README updates --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b7f343..2c8f38f 100644 --- a/README.md +++ b/README.md @@ -136,12 +136,14 @@ Use the `Pool` or `Client` constructors, instead of the functions described abov Queries using `Pool` and `Client` are carried by WebSockets. There are **two key things** to know about this: -1. **In Node.js** and some other environments, there's no built-in WebSocket support. In these cases, supply a WebSocket constructor function. +1. **In Node.js v21 and earlier** and some other environments, there's no built-in WebSocket support. In these cases, supply a WebSocket constructor function. 2. **In serverless environments** such as Vercel Edge Functions or Cloudflare Workers, WebSocket connections can't outlive a single request. That means `Pool` or `Client` objects must be connected, used and closed **within a single request handler**. Don't create them outside a request handler; don't create them in one handler and try to reuse them in another; and to avoid exhausting available connections, don't forget to close them. + Note: on Cloudflare Workers, consider [using Cloudflare Hyperdrive](https://neon.tech/blog/hyperdrive-neon-faq) instead of this driver. + These points are demonstrated in the examples below. ### API