Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@vercel/postgres Document the use of LISTEN and NOTIFY (if at all possible). #524

Open
romeovs opened this issue Dec 8, 2023 · 2 comments

Comments

@romeovs
Copy link

romeovs commented Dec 8, 2023

The documentation states full compatibility with postgres, does this include LISTEN/NOTIFY?

The Neon docs mention LISTEN/NOTIFY and it works from psql so I would assume we can use them, but I see no clear way to call these commands from the SDK.

import { sql } from "@vercel/postgres"

const res = await sql`LISTEN foo`
console.log(res)
// This immediately returns
// {
//   command: "LISTEN",
//   fields: [],
//   rowAsArray: false,
//   rowCount: null,
//   rows: [],
//   viaNeonFetch: true
// }

Is this feature supported, and if so, what are the limitations.

If not, can we clarify that in the docs?

@abhishekchouhannk
Copy link

Hi remeovs, were you able to figure this out?
I too have been in a bind, struggling with trying to get my vercel/postgres to send a notification to my node.js app hosted on a different domain.

However, none of the methods I tried seemed to work.

@vvo
Copy link
Member

vvo commented Mar 11, 2024

@romeovs, I'm not sure if you got an answer elsewhere, but given the nature of serverless, it would seem that listen/notify could behave strangely, as "clients" could connect and disconnect anytime in a much more random way than traditional servers/clients.

What was your usecase for listen/notify in the context of your application? good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants