2
0
mirror of https://github.com/esiur/esiur-dart.git synced 2025-06-27 06:43:13 +00:00

Resume connection

This commit is contained in:
2020-03-25 04:59:27 +03:00
parent 586088aad9
commit 09b010612a
5 changed files with 210 additions and 77 deletions

View File

@ -48,11 +48,17 @@ class NetworkConnection extends IDestructible
bool _processing = false;
// to be overridden
void connectionClosed()
{
}
void destroy()
{
// if (connected)
close();
emitArgs("close", [this]);
//emitArgs("close", [this]);
//OnDestroy?.Invoke(this);
}
@ -73,7 +79,6 @@ class NetworkConnection extends IDestructible
socket.on("receive", socket_OnReceive);
socket.on("close", socket_OnClose);
socket.on("connect", socket_OnConnect);
}
@ -84,6 +89,7 @@ class NetworkConnection extends IDestructible
void socket_OnClose()
{
connectionClosed();
emitArgs("close", [this]);
}
@ -153,10 +159,8 @@ class NetworkConnection extends IDestructible
void close()
{
try
{
if (_sock != null)
_sock.close();
}