-
Notifications
You must be signed in to change notification settings - Fork 195
Open
Description
PinusSocketioClient(
ip,
13100,
onConnect: (client) {
client.request([
apiMap.GATE_getTargetConnector,
({
'roomId': roomId,
} as Map<String, dynamic>),
(data) {
client.disconnect();
completer.complete((port: data['port']) as ({
int port
}));
}
]);
},
onError: (err, client) {
Toast.show('error:$err');
client.disconnect();
if (!completer.isCompleted) {
completer.complete((port: 0));
}
},
onDisconnect: (client) {
client.disconnect();
if (!completer.isCompleted) {
completer.complete((port: 0));
}
},
);
here is my socket client code. and when socket error, I try to create a new Socket like this.
when socket error again, the onError Event called twice. The first time that event called,client's hashCode equals destroyed client's hashcode.
Here is my dispose code:
void disconnect() {
_socket.disconnect();
_socket.dispose();
_socket.close();
}
hodfords-tran-ta-mobile
Metadata
Metadata
Assignees
Labels
No labels