Skip to content

Commit 0cfd540

Browse files
committed
fix: ws open handler hook
1 parent dc802b0 commit 0cfd540

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/bee.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,6 +1384,10 @@ export class Bee {
13841384
ws.onopen = () => {
13851385
startPing()
13861386
flushQueue()
1387+
1388+
if (handler.onOpen) {
1389+
handler.onOpen(subscription)
1390+
}
13871391
}
13881392

13891393
ws.onmessage = event => {

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ export interface PubsubSubscription {
418418
}
419419

420420
export interface PubsubMessageHandler {
421+
onOpen?: (subscription: PubsubSubscription) => void
421422
onMessage: (message: Bytes, subscription: PubsubSubscription) => void
422423
onError: (error: BeeError, subscription: PubsubSubscription) => void
423424
onClose: (subscription: PubsubSubscription) => void

0 commit comments

Comments
 (0)