Ensures that WebSocket disconnection events are reported via the webSocketDidDisconnect(connection:closeCode:reason:) delegate callback only after the underlying NWConnection has been fully torn down.
Resolves some minor code indentation issues.
N.B: This should prevent a race condition that could occur where a reconnection attempt made by calling connect() immediately after receiving a webSocketDidDisconnect(…) callback would fail as the connection was not yet torn down, and therefore calling connect() would do nothing.
This PR resolves #23:
webSocketDidDisconnect(connection:closeCode:reason:)
delegate callback only after the underlyingNWConnection
has been fully torn down.N.B: This should prevent a race condition that could occur where a reconnection attempt made by calling
connect()
immediately after receiving awebSocketDidDisconnect(…)
callback would fail as theconnection
was not yet torn down, and therefore callingconnect()
would do nothing.