[erlang-questions] integrating nodejs with erlang code

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Tue Apr 16 13:18:29 CEST 2013


On Apr 10, 2013, at 8:56 PM, Dave Smith <dizzyd@REDACTED> wrote:

> There is "most efficient" and "pragmatic".
> 
> My "pragmatic" suggestion would be to run nodejs as a port (e.g. open_port) and use stdio to interact with it. Then you can let Erlang supervise a pool of nodejs VMs. If you want to be fancy, you can implement a ping/pong protocol for detecting when the nodejs system has gone off the deep end chasing down endless chains of callbacks. :)
> 
> I may or may not have had to do this recently. :)
> 

This would be my approach as well. In addition one can define a simple framing format like {packet, 4} and then pass JSON structures to node.js, which it has an easy time working with. Alternatively, you could lean the other way and pass the Erlang term format directly and write a parser for it in node.js. 

Jesper Louis Andersen
  Erlang Solutions Ltd., Copenhagen






More information about the erlang-questions mailing list