PacktPublishing/Node.js-Design-Patterns-Third-Edition

FailSafeSocket doesn't change from online to offline

z2mi opened this issue · 3 comments

z2mi commented

Hi,
I ran client and server in 09-behavioral-design-patterns/02-state-failsafe-socket directory and It seems that FailSafeSocket never changes from online to offline state. We need some code in _safeWrite method in OnlineState to change state to offline if error happens.

For some reason a socket doesn't emit 'error' event.

you can see my solution:

Created a PR to fix it.