wikiti / extension-networking

Library developed for OpenFL to facilitate connections between applications, using TCP sockets, and following the scheme of event-driven programming.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong disconnection events order for clients

wikiti opened this issue · comments

When a client closes his session, the following events are being fired:

- NETWORK_EVENT_CLOSED
- NETWORK_EVENT_DISCONNECTED

They should be fired in the following order:

- NETWORK_EVENT_DISCONNECTED
- NETWORK_EVENT_CLOSED

Actually, the behaviour is working as expected:

  • NETWORK_EVENT_CLOSED will be fired after the the session is closed manually, by calling a stop() method.
  • NETWORK_EVENT_DISCONNECTED will be fired after the client's socket has been closed, which will be done asynchronosly.
  • The chances that NETWORK_EVENT_CLOSED being fired before NETWORK_EVENT_DISCONNECTED are pretty high. However, this should not be problematic.

The documentation (README.md) should be updated before closing this issue.