File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
packages/loro-websocket/src/client Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ export class LoroWebsocketClient {
6363 } > = [ ] ;
6464
6565 constructor (
66- private ops : { url : string ; pingIntervalMs ?: number ; disablePing ?: boolean }
66+ private ops : { url : string ; pingIntervalMs ?: number ; disablePing ?: boolean , onWsClose ?: ( ) => void }
6767 ) {
6868 this . connectedPromise = new Promise < void > ( ( resolve , reject ) => {
6969 this . ws = new WebSocket ( this . ops . url ) ;
@@ -102,6 +102,7 @@ export class LoroWebsocketClient {
102102 // Clear timers and pending waiters on close
103103 this . ws . addEventListener ( 'close' , ( ) => {
104104 this . clearPingTimer ( ) ;
105+ this . ops . onWsClose ?.( ) ;
105106 this . rejectAllPingWaiters ( new Error ( "WebSocket closed" ) ) ;
106107 } ) ;
107108 }
You can’t perform that action at this time.
0 commit comments