Skip to content

Commit

Permalink
add handler
Browse files Browse the repository at this point in the history
  • Loading branch information
louis.tian authored and porsager committed Feb 17, 2024
1 parent cd02af8 commit 3e3d5e8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function Subscribe(postgres, options) {

return subscribe

async function subscribe(event, fn, onsubscribe = noop) {
async function subscribe(event, fn, onsubscribe = noop, onerror = noop) {
event = parseEvent(event)

if (!connection)
Expand All @@ -66,6 +66,7 @@ export default function Subscribe(postgres, options) {
return connection.then(x => {
connected(x)
onsubscribe()
stream && stream.on('error', onerror)
return { unsubscribe, state, sql }
})
}
Expand Down

0 comments on commit 3e3d5e8

Please sign in to comment.