Skip to content

Commit

Permalink
Resolve #108 Need dispose method for clearing resources
Browse files Browse the repository at this point in the history
  • Loading branch information
jumperchen committed Jul 31, 2020
1 parent 5297bbf commit 4ff79d2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.9.11

**New Feature:**

* [#108](https://github.com/rikulo/socket.io-client-dart/issues/108) Need dispose method for clearing resources

## 0.9.10+2

* Fix dart analyzer warning for formatting issues.
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ void main() {
}
```

### Memory leak issues in iOS when closing socket.
* Refer to https://github.com/rikulo/socket.io-client-dart/issues/108 issue.
Please use `socket.dispose()` instead of `socket.close()` or `socket.disconnect()` to solve the memory leak issue on iOS.

## Notes to Contributors

Expand Down
10 changes: 10 additions & 0 deletions lib/src/socket.dart
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,16 @@ class Socket extends EventEmitter {
return this;
}

/// Disposes the socket manually which will destroy, close, disconnect the socket connection
/// and clear all the event listeners. Unlike [close] or [disconnect] which won't clear
/// all the event listeners
///
/// @since 0.9.11
void dispose() {
disconnect();
clearListeners();
}

///
/// Sets the compress flag.
///
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: socket_io_client
description: Dartlang port of socket.io-client for web, flutter, dartvm to use
version: 0.9.10+2
version: 0.9.11
homepage: https://www.zkoss.org
repository: https://github.com/rikulo/socket.io-client-dart
issue_tracker: https://github.com/rikulo/socket.io-client-dart/issues
Expand Down

0 comments on commit 4ff79d2

Please sign in to comment.