Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Clear WebSocket event listeners on close. (#615)
Browse files Browse the repository at this point in the history
* Clear WebSocket event listeners on close.

* Changelog update

Co-authored-by: hwillson <hugh@octonary.com>
  • Loading branch information
tretne and hwillson authored Aug 10, 2020
1 parent 4af30a5 commit 2e4bb91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

- Do not send GQL_STOP when unsubscribing after GQL_COMPLETE is received. <br/>
[@onhate](https://github.com/onhate) in [#775](https://github.com/apollographql/subscriptions-transport-ws/pull/775)
- Clear WebSocket event listeners on close. <br/>
[@tretne](https://github.com/tretne) in [#615](https://github.com/apollographql/subscriptions-transport-ws/pull/615)

### New Features

Expand Down
4 changes: 4 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ export class SubscriptionClient {
}

this.client.close();
this.client.onopen = null;
this.client.onclose = null;
this.client.onerror = null;
this.client.onmessage = null;
this.client = null;
this.eventEmitter.emit('disconnected');

Expand Down

0 comments on commit 2e4bb91

Please sign in to comment.