hapijs / nes

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

eachSocket behaves as synchronous without filter, but async with filter #248

Closed p16 closed 5 years ago

p16 commented 6 years ago

Hi there, when using the subscription filter I think the eachSocket function behaves as async instead of synchronous.

route.subscribers._forEachSubscriber is used in eachSocket but its definition makes it an async function.

I'm open to work on a fix on this, but I'm not sure how to proceed given the each function passed to _forEachSubscriber sometimes is synchronous and sometimes is async.

Do you have any idea?

mtharrison commented 6 years ago

Good spot. As we accept an async each() we probably need to return Promises from the functions that call that and document appropriately.

hueniverse commented 5 years ago

The resolution is to move the entire interface to async. In most cases this would not be a breaking change, but some operations (as seen in the test) would now require an await next to eachSocket().

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.