You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that `.connect()` should not be called if `autoConnect: true`, as this will cause all event handlers to get registered/fired twice. See [Issue #33](https://github.com/rikulo/socket.io-client-dart/issues/33).
60
+
Note that `.connect()` should not be called if `autoConnect: true`
61
+
(by default, it's enabled to true), as this will cause all event handlers to get registered/fired twice. See [Issue #33](https://github.com/rikulo/socket.io-client-dart/issues/33).
59
62
60
63
### Update the extra headers
61
64
@@ -69,7 +72,7 @@ socket.io..disconnect()..connect(); // Reconnect the socket manually.
69
72
70
73
```dart
71
74
Socket socket = ... // Create socket.
72
-
socket.on('connect', (_) {
75
+
socket.onConnect((_) {
73
76
print('connect');
74
77
socket.emitWithAck('msg', 'init', ack: (data) {
75
78
print('ack $data') ;
@@ -103,10 +106,10 @@ const List EVENTS = [
103
106
'pong'
104
107
];
105
108
106
-
// Replace 'connect' with any of the above events.
107
-
socket.on('connect', (_) {
109
+
// Replace 'onConnect' with any of the above events.
110
+
socket.onConnect((_) {
108
111
print('connect');
109
-
}
112
+
});
110
113
```
111
114
112
115
### Acknowledge with the socket server that an event has been received.
Note that `.connect()` should not be called if `autoConnect: true`, as this will cause all event handlers to get registered/fired twice. See [Issue #33](https://github.com/rikulo/socket.io-client-dart/issues/33).
60
+
Note that `.connect()` should not be called if `autoConnect: true`
61
+
(by default, it's enabled to true), as this will cause all event handlers to get registered/fired twice. See [Issue #33](https://github.com/rikulo/socket.io-client-dart/issues/33).
59
62
60
63
### Update the extra headers
61
64
@@ -69,7 +72,7 @@ socket.io..disconnect()..connect(); // Reconnect the socket manually.
69
72
70
73
```dart
71
74
Socket socket = ... // Create socket.
72
-
socket.on('connect', (_) {
75
+
socket.onConnect((_) {
73
76
print('connect');
74
77
socket.emitWithAck('msg', 'init', ack: (data) {
75
78
print('ack $data') ;
@@ -103,10 +106,10 @@ const List EVENTS = [
103
106
'pong'
104
107
];
105
108
106
-
// Replace 'connect' with any of the above events.
107
-
socket.on('connect', (_) {
109
+
// Replace 'onConnect' with any of the above events.
110
+
socket.onConnect((_) {
108
111
print('connect');
109
-
}
112
+
});
110
113
```
111
114
112
115
### Acknowledge with the socket server that an event has been received.
0 commit comments