Open averri opened 4 years ago
@averri Any luck figuring out how to setup with feathers?
Hi @ppatel890, unfortunately I have abandoned the use of cls-hooked, I have re-engineered the application code to do not rely on cls-hooked.
@averri - checking back in, any guidance on how you can have a requestId present throughout the entire socket 'request'?
Hi @ppatel890, Nodejs 13 has a solution for this problem: https://nodejs.org/docs/latest-v13.x/api/async_hooks.html#async_hooks_class_asynclocalstorage
In order to have a variable associated with the context of the current request it needs the support of AsyncLocalStorage in the SocketIO middleware.
The AsycLocalStorage has similar features of this library, so it's recommended to move to AsyncLocalStorage.
Hi @ppatel890, Nodejs 13 has a solution for this problem: https://nodejs.org/docs/latest-v13.x/api/async_hooks.html#async_hooks_class_asynclocalstorage
In order to have a variable associated with the context of the current request it needs the support of AsyncLocalStorage in the SocketIO middleware.
The AsycLocalStorage has similar features of this library, so it's recommended to move to AsyncLocalStorage.
@averri This library already uses async_hooks
on Node 8+
I'm trying to integrate the
cls_hooked
with SocketIO, using the Feathersjs framework:The
tracer.js
:... but the context is lost, it's not possible to get the 'ip' property from service functions.