question about node.js compatibility
Hi there!
I took a look at the project and it looks pretty cool. I saw that you were looking for some sort of compatibility with node.js - is this right? If so, y'all might want to take a look at nodejs/api. It is an effort by the nodejs foundation to move towards a standardized API that allows platforms like this to have a real standard.
Maybe you're interested :smile:
@brendanashworth Hi, thank you for information. As you mentioned, supporting node.js API is one of main task in IoT.js. Currently, we are referencing https://nodejs.org/api/ as base.
We think that we can't cover the whole set of node.js APIs, because of limited memory in IoT devices. So we are trying to define several subsets of node.js API. One for mandatory, others are optionally loaded on demand as *.npm like module.
As of now, our 1st candidate of mandatory API for IoT.js are as follow. (Listed in module resolution) Your comments always welcome. Thanks!
1st candidate of IoT.js mandatory module
- ~~Assertion Testing~~
- Buffer
- ~~C/C++ Addons~~
- ~~Child Processes~~
- ~~Cluster~~
- Console
- ~~Crypto~~
- ~~Debugger~~
- ~~DNS~~
- ~~Domain~~
- Events
- File System
- Globals
- ~~HTTP~~
- ~~HTTPS~~
- Modules
- ~~Net~~
- ~~OS~~
- ~~Path~~
- Process
- ~~Punycode~~
- ~~Query Strings~~
- ~~Readline~~
- ~~REPL~~
- ~~Smalloc~~
- Stream
- ~~String Decoder~~
- Timers
- ~~TLS/SSL~~
- ~~TTY~~
- ~~UDP/Datagram~~
- ~~URL~~
- Utilities
- ~~VM~~
- ~~ZLIB~~
Sounds like a good set of modules - no native addons?
As a side comment, maybe this list will interest y'all. :smile:
@brendanashworth Yes, I think we'll eventually support native addon. It seems like the link you are referring is for standardizing kind of embeding API for native addon. right? I think it's cool. Once that kind of standard was established, any native addon developed base on it could run on any platform supporting it (ex. node.js, iot.js and something more). We surely interested and will keep watch on it.
It would be nice to see UDP/Datagram sockets, as they are superb to use in HTTP and WebSockets later. But I have no clue how to implement them myself...
UDP sockets are also important in implemeting CoAP and similar protocols.
FYI, a significant goal of the node API working group is to standardize a lower-level API that the existing JS files in lib/ would sit on top of. (Rather than the implementation-specific process.bindings(...) interface)
I think it would be worthwhile to coordinate and communicate your needs to the node API working group to work towards full compatibility with the lower-level API and only differing on the scope of what the JS files on top of it do. The lower-level API is still very open for discussion, so the influence of vendors with platform limitation concerns would be very valuable to shaping a highly portable and performant API.
Updated candidate for IoT.js API. https://github.com/Samsung/iotjs/wiki/IoT.js%20API%20Reference @martensms @drasko UDP and CoAP is classified as 'Extended API' at this time.
Please check the milestone for progress. https://github.com/Samsung/iotjs/milestones
Thanks!
Is there any plan to support websockets on iot.js?
@aquaherd iot.js already supports the http and the net stack. So you can implement websockets on your own, as everything underlying is ready for it.
Thanks, I will try that.