Skip to content

Commit 4ff79d2

Browse files
committed
Resolve #108 Need dispose method for clearing resources
1 parent 5297bbf commit 4ff79d2

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.9.11
2+
3+
**New Feature:**
4+
5+
* [#108](https://github.com/rikulo/socket.io-client-dart/issues/108) Need dispose method for clearing resources
6+
17
## 0.9.10+2
28

39
* Fix dart analyzer warning for formatting issues.

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ void main() {
152152
}
153153
```
154154

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

156159
## Notes to Contributors
157160

lib/src/socket.dart

+10
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,16 @@ class Socket extends EventEmitter {
407407
return this;
408408
}
409409

410+
/// Disposes the socket manually which will destroy, close, disconnect the socket connection
411+
/// and clear all the event listeners. Unlike [close] or [disconnect] which won't clear
412+
/// all the event listeners
413+
///
414+
/// @since 0.9.11
415+
void dispose() {
416+
disconnect();
417+
clearListeners();
418+
}
419+
410420
///
411421
/// Sets the compress flag.
412422
///

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: socket_io_client
22
description: Dartlang port of socket.io-client for web, flutter, dartvm to use
3-
version: 0.9.10+2
3+
version: 0.9.11
44
homepage: https://www.zkoss.org
55
repository: https://github.com/rikulo/socket.io-client-dart
66
issue_tracker: https://github.com/rikulo/socket.io-client-dart/issues

0 commit comments

Comments
 (0)