ohler55 / agoo-c

Agoo webserver in C.
MIT License
146 stars 16 forks source link

Any plan or guide for NodeJS support? #6

Closed dalisoft closed 4 years ago

dalisoft commented 4 years ago

Hi @ohler55.

I see your library leads in benchmark at request/sec and may we create something great. I am author of nanoexpress and I'd happy to try your library as replacement of uWebSockets.js for some-cases (with something like { agooC: true } option FLAG currently).

Are you can help me with that?

1: My offer is like open-source help and i am know time is less, need work, i mean, if you have FREE time, we can build something 2: I always paste link to source codes, if we make it work in nanoexpress, i will paste link to agoo-c too), like currently i pasted source links

ohler55 commented 4 years ago

I would be honoured to help make Agoo-C an option for nanoexpress. Can you tell me which file I can start looking at in nanoexpress?

dalisoft commented 4 years ago

Hi and thanks for help. Mainly, all uWS code here.

https://github.com/dalisoft/nanoexpress/blob/master/src/nanoexpress.js

dalisoft commented 4 years ago

@ohler55 We can make binding for node.js like uWS or node-sass? Would be great if we make integration and build the FASTEST available Node.js server which helps other reduce cost and improve performance of their application

ohler55 commented 4 years ago

It is a new direction to take Agoo-C so I need to figure out what is needed. Traveling today but will look into it this week and the coming weekend.

dalisoft commented 4 years ago

Great. Thank you.

ohler55 commented 4 years ago

I've looked at this from a couple of different angles and I keep coming back to the need to create a node plugin first and then consider hooking into nanoexpress. I'm not ready to write a node plugin yet. Too much else going on. If you wanted to start that I'd be glad to help out and even write some of the code but node is a new world for me.

dalisoft commented 4 years ago

Thanks for trying, for me C/C++ also new world. One question, is agoo supports Http2 and there has way to support SSL/Http2? If yes, i will start doing plugin

ohler55 commented 4 years ago

SSL for Agoo is the next feature on my list. I have only started planning that so far.

dalisoft commented 4 years ago

Great, SSL if next feature, then nice. After SSL, please try implement http2. I planning create full-featured website for nanoexpress (Simple/Pro), selling license and agoo will be available on both simple (free) and pro (premium) version. 50% cost of first 100 selling license cost will be to you, other 50% cost to Alex for uWebSockets.js.

ohler55 commented 4 years ago

Good luck with your plans. I'll do my best to get Agoo in shape for you.

dalisoft commented 4 years ago

Thanks for your support. We need to peoples which wants performance + ease-of-use with flexible options. We make our best to give users what they looking a lot of time, none of other frameworks has performance + flexibility + ease-of-use.

dalisoft commented 4 years ago

Hi @ohler55. Sorry for a lot of delay, i got some free time and trying to port to Node.js. I'm new to C/C++ (no background), so sorry if something doing wrong, but i here to ask help from you.

When building to only one method (just for start), getting a lot errors

agoo-node on  master is 📦 v1.0.0 via ⬢ v13.5.0 
❯ npm run build

> agoo-node@1.0.0 build /Users/dalisoft/Desktop/NPM/agoo-node
> node-gyp rebuild

  CXX(target) Release/obj.target/agoo/src/addon.o
In file included from ../src/addon.cc:4:
In file included from ../src/agoo.c:8:
In file included from ../src/agoo.h:10:
In file included from ../src/agoo/req.h:8:
In file included from ../src/agoo/hook.h:9:
In file included from ../src/agoo/queue.h:9:
../src/agoo/atomic.h:37:9: warning: 'ATOMIC_FLAG_INIT' macro redefined [-Wmacro-redefined]
#define ATOMIC_FLAG_INIT        { .value = NULL, .lock = PTHREAD_MUTEX_INITIALIZER }
        ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/atomic:1883:9: note: 
      previous definition is here
#define ATOMIC_FLAG_INIT {false}
        ^
In file included from ../src/addon.cc:4:
../src/agoo.c:243:21: error: assigning to 'char *' from incompatible type 'void *'
        if (NULL == (sdl = AGOO_MALLOC(size))) {
                           ^~~~~~~~~~~~~~~~~
../src/agoo/debug.h:35:27: note: expanded from macro 'AGOO_MALLOC'
#define AGOO_MALLOC(size) malloc(size)
                          ^~~~~~~~~~~~
../src/addon.cc:8:5: error: no matching function for call to 'NODE_SET_METHOD'
    NODE_SET_METHOD(target, "start", agoo_start);
    ^~~~~~~~~~~~~~~
/Users/dalisoft/Library/Caches/node-gyp/13.5.0/include/node/node.h:486:25: note: expanded from macro 'NODE_SET_METHOD'
#define NODE_SET_METHOD node::NODE_SET_METHOD
                        ^~~~~~~~~~~~~~~~~~~~~
/Users/dalisoft/Library/Caches/node-gyp/13.5.0/include/node/node.h:472:13: note: candidate function not viable: no known
      conversion from 'int (agooErr, const char *)' (aka 'int (_agooErr *, const char *)') to 'v8::FunctionCallback' (aka 'void
      (*)(const FunctionCallbackInfo<v8::Value> &)') for 3rd argument
inline void NODE_SET_METHOD(v8::Local<v8::Object> recv,
            ^
/Users/dalisoft/Library/Caches/node-gyp/13.5.0/include/node/node.h:458:13: note: candidate function not viable: no known
      conversion from 'int (agooErr, const char *)' (aka 'int (_agooErr *, const char *)') to 'v8::FunctionCallback' (aka 'void
      (*)(const FunctionCallbackInfo<v8::Value> &)') for 3rd argument
inline void NODE_SET_METHOD(v8::Local<v8::Template> recv,
            ^
1 warning and 2 errors generated.
make: *** [Release/obj.target/agoo/src/addon.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:305:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/Cellar/node/13.5.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/dalisoft/Desktop/NPM/agoo-node
gyp ERR! node -v v13.5.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! agoo-node@1.0.0 build: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the agoo-node@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/dalisoft/.npm/_logs/2019-12-24T14_12_34_931Z-debug.log
agoo-node on  master is 📦 v1.0.0 via ⬢ v13.5.0 took 6s 
❯

Repository: https://github.com/dalisoft/agoo-node

Also, would be great if there any docs for me for better understanding what how works

dalisoft commented 4 years ago

I forgot mention, i'm in plan of to switch from uWebSockets.js to agoo-c for some reasons. Not just for performance. I hope we can make it

dalisoft commented 4 years ago

I cannot able to create addon for Node.js, so i close this issue as i cannot make this in future too and i don’t have time too.

If someone wants create or help, welcome to agoo-node repo

ohler55 commented 4 years ago

There never seems to be enough time. Maybe it will open up again in the future.