OpenFL and Nodejs

Can I do nodejs from/with openfl ? I have been trying to read up on it but haven’t managed. If anyone has some links for reading material I would appreciate it.
Mostly looking to generate the server side stuff and not being able to get it to happen. Though reading on how to access the server from the client would help too.

What features would you like to use?

The image processing requires canvas, but it (might) be possible to make it work with node-canvas, or something similar, unless there are more direct Cairo bindings, or we sort out how to make CFFI work on node

I was looking at webrtc and d3, interop between the two to display data sent through encrypted channels, I did not know about node-canvas, so that’s good news right there because of d3. :slight_smile:

Edit 1: Was able to get a node server going with vanilla haxe to serve files and also with go lang. But think having nodejs with openfl would be better for the use case.

Edit 2: Getting 'nodetest1.js:71601 openfl__$internal_renderer_canvas_CanvasGraphics.hitTestCanvas = window.document.createElement(“canvas”);

ReferenceError: window is not defined
at D:\WORK\HXPROJECTS\node_test4\node_test4\bin\html5\bin\nodetest4.js:33461:66
at Object. (D:\WORK\HXPROJECTS\node_test4\node_test4\bin\html5\bin\nodetest4.js:33591:3)
at Module._compile (module.js:643:30)
at Object.Module._extensions…js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3’

running into this if I try to go with openfl for making a server.
Using html5 -Djs-es5 maybe wrong in this case… I don’t know.

Are you trying the haxelib version of OpenFL, or the NPM version? If you have not already, please try the NPM version, I’m using it already for a Node.js set of command-line tools (SWF processing), so it should be better prepared for running in a Node.js environment (though it has not been fully tested)

So…

npm install haxe
yo openfl
npm start
?

Is there some recommended IDE for this ? Asking for the better auto completion option.

Edit 1: npm install haxe isn’t even needed, doh!

There’s docs here: www.openfl.org/download

You need to npm install before you npm start :slight_smile:

2 Likes