Skip to content

Commit 68de425

Browse files
mcraveiroclaude
andcommitted
Document LISTEN/NOTIFY support for Postgres connections
Add documentation section covering the listen/notify API including subscribe, unsubscribe, notify, and notification retrieval methods. Includes note about using dedicated connections outside connection pools. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 84e5f3b commit 68de425

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/postgres.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ const auto minors = query(conn);
6464

6565
PostgreSQL provides a simple publish-subscribe mechanism through `LISTEN` and `NOTIFY` commands. This allows database clients to receive real-time notifications when events occur, without polling. Any client can send a notification to a channel, and all clients listening on that channel will receive it asynchronously.
6666

67+
> **Note:** You should use a dedicated connection for LISTEN/NOTIFY, separate from your main database activity and outside any connection pool. This is because the listening connection must remain open and persistent to receive notifications, and connection pools typically recycle connections which would lose the LISTEN state.
68+
6769
### API
6870

6971
The `Connection` class provides the following methods for listen/notify:

0 commit comments

Comments
 (0)