Closed comods closed 4 years ago
Do you have any example of something that fails? This project is not an Electron module, so any issues with Electron is out of scope.
Just using the NodeJS CLI switch "--force-context-aware":
Error: This version of µWS is not compatible with your Node.js build: Error: Loading non context-aware native modules has been disabled
This isn't an error with µWS but a feature request to change the C++ Addon glue code to play nice when multi-threaded.
https://nodejs.org/api/addons.html#addons_context_aware_addons explains it better then I can.
That flag was added like one month ago. And they mention Electron users specifically.
Context aware add-ons sounds sane, but will require dropping nodejs 10 and 11 support from what I can tell. That's not going to happen any time soon.
What, it was added in Node.js 10 it seems: https://nodejs.org/docs/latest-v10.x/api/addons.html#addons_context_aware_addons
This sounds very sane, and should be relatively simple to fix. This will also clean up confusion regarding Isolate and Context in the addon.
An Isolate holds many Contexts, and all functions should only store/load JS data from correct Context. This is vanilla V8 concepts also, so it is not tied to Node.js or Electron.
I have some code here that works. Needs performance fixes though.
This change actually adds Worker threads support
npm install uNetworking/uWebSockets.js#binaries
You can try it
NodeJS has a command line switch "--force-context-aware" which prevents some hard to track down errors errors with Electron (electronjs.org) and native modules.
µWS is currently not a context-aware native module.
Here is the documentation about context-aware native modules: https://nodejs.org/api/addons.html#addons_context_aware_addons
I do not know if this is easy or hard to do, or if it will have any effect on performance.
Thanks for this great WebSocket module.