Skip to content

Commit 08fcaa5

Browse files
committed
Describe listen await
1 parent 3c6edc8 commit 08fcaa5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ await sql`
123123

124124
## Listen and notify
125125

126-
When you call listen, a dedicated connection will automatically be made to ensure that you receive notifications in real time. This connection will be used for any further calls to listen.
126+
When you call listen, a dedicated connection will automatically be made to ensure that you receive notifications in real time. This connection will be used for any further calls to listen. Listen returns a promise which resolves once the `LISTEN` query to Postgres completes, or if there is already a listener active.
127127

128128
```js
129129

130-
sql.listen('news', payload => {
130+
await sql.listen('news', payload => {
131131
const json = JSON.parse(payload)
132132
console.log(json.this) // logs 'is'
133133
})

0 commit comments

Comments
 (0)