File tree Expand file tree Collapse file tree 5 files changed +13
-9
lines changed Expand file tree Collapse file tree 5 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " detritus-client-socket" ,
3
- "version" : " 0.3.2 " ,
3
+ "version" : " 0.3.3 " ,
4
4
"description" : " A TypeScript NodeJS library to interact with Discord's Gateway" ,
5
5
"main" : " lib/index.js" ,
6
6
"types" : " lib/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -88,13 +88,14 @@ export class BaseSocket extends EventEmitter {
88
88
) : void {
89
89
if ( this . connected ) {
90
90
this . socket . close ( code , reason ) ;
91
- for ( const [ nonce , { reject} ] of this . pings ) {
92
- reject ( new Error ( 'Socket has closed.' ) ) ;
93
- this . pings . delete ( nonce ) ;
94
- }
95
- this . pings . clear ( ) ;
96
- this . removeAllListeners ( ) ;
97
91
}
92
+ for ( const [ nonce , { reject} ] of this . pings ) {
93
+ reject ( new Error ( 'Socket has closed.' ) ) ;
94
+ this . pings . delete ( nonce ) ;
95
+ }
96
+ this . pings . clear ( ) ;
97
+ this . socket . removeAllListeners ( ) ;
98
+ this . removeAllListeners ( ) ;
98
99
}
99
100
100
101
onPong ( data : any ) : void {
Original file line number Diff line number Diff line change 1
1
export const Package = Object . freeze ( {
2
2
URL : 'https://github.com/detritusjs/client-socket' ,
3
- VERSION : '0.3.2 ' ,
3
+ VERSION : '0.3.3 ' ,
4
4
} ) ;
5
5
6
6
function normalize ( object : { [ key : string ] : any } ) {
Original file line number Diff line number Diff line change @@ -545,6 +545,7 @@ export class Socket extends EventEmitter {
545
545
socket . kill ( error ) ;
546
546
}
547
547
this . emit ( SocketEvents . KILLED , { error} ) ;
548
+ this . removeAllListeners ( ) ;
548
549
}
549
550
}
550
551
Original file line number Diff line number Diff line change @@ -310,8 +310,8 @@ export class Socket extends EventEmitter {
310
310
reason = < string > SocketInternalCloseReasons [ code ] ;
311
311
}
312
312
this . socket . close ( code , reason ) ;
313
+ this . socket = null ;
313
314
}
314
- this . socket = null ;
315
315
}
316
316
317
317
encode ( data : any ) : null | string {
@@ -434,10 +434,12 @@ export class Socket extends EventEmitter {
434
434
this . disconnect ( SocketCloseCodes . NORMAL ) ;
435
435
if ( this . transport ) {
436
436
this . transport . disconnect ( ) ;
437
+ this . transport . removeAllListeners ( ) ;
437
438
this . transport = null ;
438
439
}
439
440
this . resolvePromises ( error || new Error ( 'Media Gateway was killed.' ) ) ;
440
441
this . emit ( SocketEvents . KILLED ) ;
442
+ this . removeAllListeners ( ) ;
441
443
}
442
444
443
445
onClose (
You can’t perform that action at this time.
0 commit comments