Can Duktape make http requests

2k Views Asked by At

I have a very simple duktape plugin running embedded in another program. Simple stuff works, but I am not sure how to make HTTP requests. Is it even possible to make HTTP Request from within a Duktape VM?

4

There are 4 best solutions below

1
aggsol On BEST ANSWER

No you can't. The hosting application must provide it to Duktape. Duktape provides a JavaScript runtime but does not provide function you also find in browsers when using JavaScript.

0
Lordrem On

In order to make http requests within your duktape program, you must bind a native function (in C if your program is in C) that will make the request and inject back the answer

1
alknows On

It would be nice to implement XMLHttpRequest in duktape. That would open the door to many useful use cases and bring it one step closer to using popular js libraries. Are there any plans for that?

0
buaa.byl On

You can implement socket interface in c, then register to duktape.