hapijs / nes

WebSocket adapter plugin for hapi routes
Other
502 stars 87 forks source link

Add ability to revoke a socket ignoring if it is already closed #284

Closed rankida closed 5 years ago

rankida commented 5 years ago

In cases where there is an onUnsubscribe handler registered it is possible that revoke can be called on a socket that has since been closed. This results in an error being thrown.

To prevent having to try/catch and explicitly test for nes's internal Socket not open error this new flag throwIfClosed allows the user to signal their intent to "fire and forget".

Because revoke is async internally it is not possible to catch this with certainty prior to making the revoke call.

The added tests demonstrate the issue we are seeing in production.

rankida commented 5 years ago

I am going to blame Travis for the failing builds.

image

This PR now has the same success (or a little more) than master appears to have.

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.